Thanks for the reply. It just seems like I am putting 100 functions in the one controller and a 100 views in the one folder. Just managing the code and the single file could get complicated. 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] </user/SendEmail.jtp?type=node&node=5663027&i=0>> 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] </user/SendEmail.jtp?type=node&node=5663027&i=1> 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] </user/SendEmail.jtp?type=node&node=5663027&i=2> 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.html > > > To start a new topic under CakePHP, email > ml-node+s1045679n125572...@n5.nabble.com > To unsubscribe from CakePHP, click here > <http://cakephp.1045679.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1255722&code=YmlsbC5zdG9sdHpAYm9vc3RlcndlYnNvbHV0aW9ucy5jb218MTI1NTcyMnwtNTU0NTk2MTUy>. > NAML > <http://cakephp.1045679.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > > -- View this message in context: http://cakephp.1045679.n5.nabble.com/Understanding-MVC-Architecture-tp5657637p5663601.html 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php