Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

Two DataObject within one Page


Go to End


4 Posts   1170 Views

Avatar
bunheng

Community Member, 78 Posts

16 June 2011 at 9:15pm

Hi,

I would like to know is it possible to use two DataObject within one page
I have the following code within my module

- ResourceItem.php ---> DataObject
- ActivityItem.php ---> DataObject
- LocationPage.php ---> Page

I really appreciated for your kindness advice and tutorials.

Bunheng

Avatar
UncleCheese

Forum Moderator, 4102 Posts

17 June 2011 at 5:24am

static $has_many = array (
'ResourceItems' => 'ResourceItem',
'ActivityItems' => 'ActivityItem'
);

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

Avatar
bunheng

Community Member, 78 Posts

17 June 2011 at 9:50pm

Hi,

How can we put in function GetCMSField() with two different DataObjects.

Regards,
Bunheng

Avatar
UncleCheese

Forum Moderator, 4102 Posts

18 June 2011 at 8:23am

new DataObjectManager($this,'FirstDataObjects','FirstDataObject')
new DataObjectManager($this,'SecondDataObjects','SecondDataObject');