But from a user experience, they are managing the organization. These are just areas to manage.
So, maybe my question should be...
What is a better way to manage the code? Maybe I should create components to manage the code related to a Model?
On 4/24/2012 3:08 PM, lowpass [via CakePHP] wrote:
I think there are no hard and fast rules for this. I've done that in
the past where it seems to make sense to list the associated model
data from a particular controller. If all you want to do is list the
Members of a given Organization -- and not provide links to do
anything further with a given Member -- then it might be fine to put
the action in OrganizationsController. However, I'll generally create
a controller for the other model(s), if only for admin functions. In
your case, you may have a need for an admin to create a new
OrganizationRole, for example.
On Sun, Apr 22, 2012 at 12:45 PM, bs28723
<[hidden email]> wrote:
> My question is - Is it a better MVC architecture to have a 1 to 1
> relationship for a controller to access the model and the view, or since
> in a case where all relationships stem from a single model - just make
> the one controller have all the actions, but pull data from the related
> models needed together to then send to a view.
>
> Here is some code to help illustrate what I am talking about. ( I
> removed a lot of configuration details, because it is not relevant for
> the architecture discussion)
>
> Organization Model
> $hasMany = array('OrganizationRole', 'Address', 'MemberRelationship');
> $belongsTo = array('User');
>
> OrganizationRole Model
> $hasMany = array('OrganizationPermission', 'MemberRelationship');
> $belongsTo = array('Organization');
>
> MemberRelationship Model
> $belongsTo = array('Organization', 'User', 'MembershipLevel',
> 'OrganizationRole');
>
> OrganizationPermission Model
> $belongsTo = array('OrganizationRole');
>
> User Model
> $hasMany = array('Organization', 'MemberRelationship', 'Address');
>
>
> So, as you can see, everything is related to Organization either
> directly or indirectly. So, I am thinking of adding actions to
> OrganizationsController to do things like viewMembers, editMembers,
> deleteMembers, viewRoles, editRoles, assignRoles, etc
> rather than putting calling view, edit, delete actions in
> MemberRelationshipsController and OrganizationRolesControllers.
>
> Any thoughts? Opinions? Suggestions?
>
> Thanks,
> Bill
>
> ________________________________
> View this message in context: Understanding MVC Architecture
> Sent from the CakePHP mailing list archive at Nabble.com.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [hidden email] For more options, visit this group at
> http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
If you reply to this email, your message will be added to the discussion below:http://cakephp.1045679.n5.nabble.com/Understanding-MVC-Architecture-tp5657637p5663027.htmlTo start a new topic under CakePHP, email [hidden email]
To unsubscribe from CakePHP, click here.
NAML
View this message in context: Re: Understanding MVC Architecture
Sent from the CakePHP mailing list archive at Nabble.com.
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment