21295 Posts in 5734 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 887 Views |
-
Where to put CRUD operations in MVC world

3 September 2010 at 6:40pm Last edited: 3 September 2010 7:22pm
Hi
Im having a little trouble grasping the true MVC concepts. Models should be fat right and controllers skinny and views dumb?
I see the whole Holder concept - a container for multiple pages/objects of same type - But im not sure where to put the CRUD logic. In the holder controller?
The site im working on has several teams with several members. All CRUD is handled by the users in the web frontend and not in the CMS. So to add a new player/member to the team needs an addPlayer action. Would this action be on the TeamHolder or on the Player class? It doesnt make much sense to have an object that adds itself to another page. So since the Teams has players maybe the actions should be handled there?
From the modules I find on the website I think that the Holder classes are also used for CRUD operations.
Could someone perhaps enlighten me?Thanks!
-
Re: Where to put CRUD operations in MVC world

3 September 2010 at 7:17pm
Well the holder pattern is different to the MVC concept. Since the CRUD operations are normally initialized via the URL then it makes sense to have them tied to the controller class (eg controller/add, controller/delete/2 etc) See the generic views module for an example of CRUD implementation in SilverStripe - http://open.silverstripe.org/browser/modules/genericviews/trunk/code
| 887 Views | ||
|
Page:
1
|
Go to Top |


