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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Two DataObject within one Page


Reply


4 Posts   858 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, 4096 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, 4096 Posts

18 June 2011 at 8:23am

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