Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » What's the right way to use DOM with DataObjectDecorator

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 282 Views
  • opex
    Community Member
    7 Posts

    What's the right way to use DOM with DataObjectDecorator Link to this post

    I have this piece of code in my decorator, which is mostly copy-paste from FormScaffolder to add a field for the many_many attribute Contacts.

    public function updateCMSFields(FieldSet &$fields) {
       $component = 'Contact';
       $relationship = 'Contacts';
       $relationshipFields = $this->getRelationshipFields();
       $filterWhere = $this->owner->getManyManyFilter($relationship, $component);
       $filterJoin = $this->owner->getManyManyJoin($relationship, $component);

       $dom = new DataObjectManager($this->owner,
       $tab = $fields->findOrMakeTab('Root.Main.Contacts',

    Existing contacts show up in the field as expected. But if I add a new contact, the contact it is saved in the Contact table, as expected, but the relation is not saved in the relationship table. If I replace DataObjectManager with ComplexTableField it works as it should.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.