1
votes

When to use Page vs Dataobject as ancestor in Silverstripe when creating data tables. I guess inheriting from Page class gives the data table page functionality but what are those page functionalities?

1
One thing to note is that Page and SiteTree extend DataObject themselves. This means that Page has all of the same behaviors and functionality of DataObject, with the additional features (versioning, nesting/tree, auto URLs and routing, etc.). If you do not need those features, then extend DataObject.Benjamin Smith

1 Answers

3
votes

You guess right ;) It's often a matter of taste what to use, both are fine for most scenarios.

Default Page functionalities are e.g. Versioning (stage / live), urlsegment and nesting of pages, you can define $allowed_children (what page types can be children of that page), who can view and edit the page... There might be some overhead for some reasons.

If you don't use it as standalone object with a given nested url you might think about using a plain DataObject for it.

With Modules like lumberjack or catalogmanager on the other hand you can edit some page types in a GridField or ModelAdmin like plain dataobjects.

So both ways have their pros and cons and it's up to you what you find better. Just try it out and play with it.