When adding a many_many relationship much like the projects to mentors relationship in the silverstripe guide:
http://doc.silverstripe.org/framework/en/tutorials/5-dataobject-relationship-management
I'd like to record an attribute against the relationship. So for example "active" - yes /no field for the mentor on the project. But the mentor might have a different value for active for different projects she is related to.
Whats the best way to achieve this with Silverstripe's built in tools?
UPDATE with some help from IRC & the answer below. ive gotten a bit closer, bit its not working. Ive found this: https://github.com/chillu/silverstripe-framework/blob/c8136f5d4c8a37a4da274cd1c93907c0a2af86a7/docs/en/reference/grid-field.md which seems very relevant.
so DebatePages have many_many panelists who can vote differently on each debate.
DebatePage.php
private static $many_many = array(
'Panelists' => 'Panelist',
'RelationTags' => 'Tag'
);
public static $many_many_extraFields = array(
'Panelists' => array('Motion' => 'Boolean')
);
public function getCMSFields() {
.....
if($this->ID) {
$panelistFields = singleton('Panelist')->getCMSFields();
$panelistFields->addFieldToTab(
'Root.Main',
// Please follow the "ManyMany[<extradata-name>]" convention
new TextField('ManyMany[Motion]', 'Agree with Motion')
);
$config = GridFieldConfig_RelationEditor::create();
$config->getComponentByType('GridFieldDetailForm')->setFields($panelistFields);
$gridField = new GridField('Panelists', 'Panelists', $this->Panelists(), $config);
$fields->findOrMakeTab('Root.Panelists')->replaceField('Panelist', $gridField);
}
}