Jump to:

3450 Posts in 1063 Topics by 738 members

Data Model Questions

SilverStripe Forums » Data Model Questions » DataObject::get and child classes

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

Page: 1
Go to End
Author Topic: 728 Views
  • KINKCreative
    Avatar
    Community Member
    56 Posts

    DataObject::get and child classes Link to this post

    I am planning on developing a few child classes from a parent one. I noticed in SiteTree if I do a DataObject::get search for a page class, it will also return all child classes.

    How does Silverstripe track ID's on child classes? Are all child class objects tracked in the parent table, too (by ID), or would I need to be careful e.g. a ChildClass starts from 1 and and a ChildClass with ID=1 may not be the same object as ParentClass ID=1?

    Hope this makes sense.

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: DataObject::get and child classes Link to this post

    Subclasses keep the exact same ID as parent classes. So if you get a ID on SubsubPage it'll be the same ID as SubPage, Page, SiteTree.

    728 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.