7607 Posts in 1236 Topics by 846 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » What to do if I want to use the DataObjectManager with different types of pages?
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 625 Views |
-
What to do if I want to use the DataObjectManager with different types of pages?

3 October 2009 at 4:00am
Now I add photos to the FotoPage with DataObjectManager (Class Foto):
class Foto extends DataObject
{
static $db = array (
'Name' => 'Text',
'Description' => 'Text',
);
static $has_one = array (
'Attachment' => 'File',
'FotoPage' => 'FotoPage'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Name'),
new TextareaField('Description'),
//new DropdownField('Category','Category', singleton('Resource')->dbObject('Category')->enumValues()),
new FileIFrameField('Attachment')
);
}
}what should I do to use the module on different types of pages: FotoPage and NewsPage?
may be sufficient to fix the code only:
'FotoPage' => 'FotoPage'
on
'FotoPage' => 'Page'
? -
Re: What to do if I want to use the DataObjectManager with different types of pages?

3 October 2009 at 4:03am
You can add as many relations as you want.
static $has_one = array (
'Attachment' => 'File',
'FotoPage' => 'FotoPage',
'SomeOtherPage' => 'SomePage',
'AnotherPage' => 'AnotherPage'
);
| 625 Views | ||
|
Page:
1
|
Go to Top |

