Hi guys,
I'm having some trouble managing a many_many relationship on the Member class.
So, I've created a decorator that appends Member with project developments. Like this
class ClientDecorator extends DataObjectDecorator
{
function extraStatics() {
return array(
'many_many' => array(
'Developments' => 'Development'
)
);
}
public function updateCMSFields(FieldSet $fields) {
$fields->addFieldToTab('Root.Members', new CheckboxField('RedirectToConveyancing', 'Redirect to Conveyancing on Login'));
$devs = DataObject::get('Development')->map('ID','Name');
$devfield = new ManyManyComplexTableField(
$this->owner,
'Developments',
'Development',
array(
'Name' => 'Name'
),
'getCMSFields_forPopup'
);
$fields->addFieldToTab('Root.Developments', $devfield);
}
}
When I edit a Member under Security in the admin, the box shows and lists the developments, complete with those assigned to the member, but when I change the developments assigned to the member and save, it doesn't store the changes. Am I doing something wrong?
Thanks,
Lee