Has anyone gotten the ManyManyDataObjectManager to work properly in ModelAdmin?
Currently, when I replace the default many-many relationship field with the ManyManyDataObjectManager, it stops me from being able to save changes on other fields/tabs.
i.e. if I make a change to any other field, I can't save the change(s) until I make a change on the MMDOM.
I'm using SS version 2.3.1 and DataObjectManager r137.
Some sample code:
class Company extends DataObject {
static $db = array(
'Name' => 'Varchar(200)'
);
static $many_many = array(
'BusinessTypes' => 'BusinessType'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab( 'Root.BusinessTypes', 'BusinessTypes' );
$fields->addFieldToTab( 'Root.BusinessTypes', new ManyManyDataObjectManager(
$this,
'BusinessTypes',
'BusinessType',
array( 'Name' => 'Business Type' )
));
return $fields;
}
}
update
To make it a bit more confusing - saving seems to work fine is you strip out the default TabSet.
You can do this by calling
$fields->changeFieldOrder( array( 'Name', 'BusinessTypes' ) )
inside getCMSFields().