Snippets » Database Retrievals » getting objects from multiple child pages
14
Apr
0
getting objects from multiple child pages
When you want to create a DataObjectSet encompasing objects from all the current pages children you can do something like this:
The first line creates an array of the ID's from all, with the current page and any descendant page ID's.
The second line onwards then gets all Objects that have an ObjectPageID that is either the current page's ID, or any child page of the current page.
You can then add the usual filter, join or limit clauses to the DataObject::get call.
About the Author
Name: Hamish Campbell
Website: http://polemic.net.nz/
Hamish is a web developer for Opus International Consultants in New Zealand. He creates tools for managing data online, with a particular interest in geographical information systems. He is also an active contributor to the SilverStripe open source project. You can find Hamish on twitter (@polemic) or catch him at his ever-neglected web home http://polemic.net.nz/.
Comments (0)
No one has commented on this page yet.
RSS feed for comments on this page RSS feed for all comments