Jump to:

23460 Posts in 18907 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Where to put CRUD operations in MVC world

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1113 Views
  • neros3
    Avatar
    Community Member
    51 Posts

    Where to put CRUD operations in MVC world Link to this post

    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!

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Where to put CRUD operations in MVC world Link to this post

    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

    1113 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.