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, Ed, biapar, Willr, Ingo, swaiba

Advise on correct usage of DataObjectManager

Go to End

2 Posts   692 Views


Community Member, 110 Posts

26 November 2010 at 10:36pm

Edited: 26/11/2010 11:21pm


I love the DOM, and my question is about cleaning things up.

I have
DataObjects ; Serie -> has many seasons -> has many episodes
Page ; SeriePage

Now when i add a Serie the popup shows with the button [ Add Season ] , but it shows in the same size as the serie popup. So when i add a Season and close the screen i want to go back to the Serie Popup and not to the CMS.

If i'm in the Season Popup and add an Episode i get a smaller popup, i want that for my season too
Now whenever i add a season and close the popup it returns me to the CMS, that's a little bit anoying.


class Serie extends DataObject{
 static $db = array ('SerieName' =>'Varchar(20)',
   ----- and some more --------

static $has_one = array(
                              'SeriePage' =>'SeriePage',
                              ' Cover' => 'Image'

static $has_many = array (' SerieSeasons' => 'SerieSeason');

public function getCMSFields()
return new FieldSet(
     new TextField('SerieName'),
    -------And Some more -----,
    new ImageUploadField('Cover'),
   new DataObjectManager(
                                       array('SeasonNmbr' => 'Seizoen')


class SerieSeason extends DataObject {

static $db = array('SeasonNmbr' =>' Varchar(20)');

static $has_one = array('Serie' => 'Serie');

static $has_many = array('SerieEpisodes' => 'SerieEpisode');

public function getCMSFields() 
   return new FieldSet
        new TextField('SeasonNmbr', ' Seizoen' ),
        new DataObjectManager(
                                             ' SerieEpisodes',
class SerieEpisode extends DataObject {

static $db = array('EpisodeName' =>' Varchar);

static $has_one = array('SerieSeason' => 'SerieSeason');
class SeriePage extends Page {

static $has_many = array ('Series' => ' Serie');

public function getCMSFields() 
  $fields = parent::getCMSFields();
  $fields -> addFieldToTab("Root.Content.Series", new DataObjectManager($this));
  return $fields;

Like i mentioned, everything is working, it's just not that userfriendly this way.

One minor issue though...After updating to SS 2.4.3 whenever i need to edit a Serie and the popup opens , the fields don't show correctly, i have to go to Next or Previous and then the Fields are allright. ( talking about the ImageUploadField and the Seasons ) this happens with the episode popup also. There i have to choose ' show all' before the fields are refreshed and i can start edit them.
{posted this issue somewhere else also }

Thank u already


Forum Moderator, 4102 Posts

27 November 2010 at 6:17am

You only get one level of nesting. You can't have three popups. That would be insane!

Either move your Series object up to the SiteTree and use the Season and Episode objects in a DOM/Nested DOM, or move the whole thing to ModelAdmin, so you can edit dataobjects at the top level.

See "Nested DOM Test" on the demo site (admin|password)

and this screencast for more info on nested DOMs:

Silverstripe tips, tutorials, screencasts, and more.