Jump to:

3373 Posts in 999 Topics by 712 members

Data Model Questions

SilverStripe Forums » Data Model Questions » inherit dataobject ( or something)

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

Page: 1 2 3
Go to End
Author Topic: 3062 Views
  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: inherit dataobject ( or something) Link to this post

    Are you still using HasOneDataObjectManager & HasManyDataObjectManager?
    Or are the screen prints now from mainly scaffolded FieldSet?

    Because what you are asking for is what I would expect when ModelAdmin does the work, but the problem you describe sounds like you are building them yourself...

  • Stefdv
    Avatar
    Community Member
    110 Posts

    Re: inherit dataobject ( or something) Link to this post

    Swaiba,

    Yes, i am using HasOneDataObjectManager & HasManyDataObjectManager...What i understand from your question is that i'm handling this the wrong way??

    ---------------------------------------------------

    //Stamboom
          $fields->addFieldToTab("Root.Stamboom", new HasOneDataObjectManager(
                             $this,
                             'Stamboom',
                             'Stamboom'
                             )
                          );
          //Showresultaten
          $fields->addFieldToTab("Root.Showresultaten", new HasManyDataObjectManager(
                             $this,
                             'Showresultaten',
                             'Showresultaat'
                             )
                          );

    ------------------------------------------------------------------------------------------------------------------------

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: inherit dataobject ( or something) Link to this post

    Well, I wouldn't say it was the wrong way, just the DOM way ;-)

    Firstly DOM functions are not silverstripe - if they don't work then the only place to ask for help in the section UncleCheese moderates - DataObjectManager. For this reason I do not use it - instead I stick close to the core.

    Secondly the silverstripe API HasManyComplexTableField & HasOneComplexTableField (which DOM builds on top) are there to use and I have occasionally added one of these - BUT with your dataobjuects set up correctly - then these are scaffolded for you - why write the code again yourself?

    I recommend you drop each one of your getCMSFields function from the data objects and see how ModelAdmin scaffolds it all, then change what you want changed...

  • Stefdv
    Avatar
    Community Member
    110 Posts

    Re: inherit dataobject ( or something) Link to this post

    Swaiba,

    Thank u so much !!!

    This totally changes the way i work with SS. I think i finnaly got it...(well...there will be questions in the future ;) )
    Now i understand what you mean with adding fields and pushing them to other tabs.

    That Modeladmin thing is great...i used everything at once ( DOM and ModelAdmin ), when in fact the modeladmin does it right.

    TX

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: inherit dataobject ( or something) Link to this post

    you are very welcome - ModelAdmin was when I started to like silverstripe alot - since I often build web applications the CRUD of data is very important and important to be able to prototype and get something running as soon as possible - write less code get more functionality - thank you silverstripe!

  • Stefdv
    Avatar
    Community Member
    110 Posts

    Re: inherit dataobject ( or something) Link to this post

    Swaiba,

    Is it possible to show all datobjects in modeladmin at once instead of per 10 ? ( I mean like default )

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: inherit dataobject ( or something) Link to this post

    sure check this out... http://open.silverstripe.org/ticket/5665
    ..it has a couple of modeladmin improvements in it, including what you ask for

    oh and if you want to change the number of results put "$this->setPageSize(15);" in your init (at the end of the dataobject init) - I don't advise putting 999999 into it to show all as this can lead a rather odd looking screen for large numbers of results

    a.u.b.

  • Stefdv
    Avatar
    Community Member
    110 Posts

    Re: inherit dataobject ( or something) Link to this post

    Swaiba,

    I'm sorry you had to stumble on me

    I'm not sure what you mean with the DataObject Init...Do i have to make a function Init, in my DataObject ?

    3062 Views
Page: 1 2 3
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.