Hi,
thanks for your answer this are good news! At least I know is my mistake.
I did more or less the same. I create a class Program as a Page and Module as a DataObject, the relation is many_many. But I get the same, I open pages then Program and go to the tab Modules, there I have the table with all the modules I added from the dataobject, but there is noway to link then in a relationship, checkbox that will insert the relation in the table Program_Modules.
******** Program.php *********
class Program extends Page {
static $many_many = array(
'Modules' => 'Module'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$dList = DataList::create('Module');
$gridFieldConfig = GridFieldConfig_RelationEditor::create();
$gridFieldConfig->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields('Name');
$gridField = new GridField('Modules', 'Modules', $dList, $gridFieldConfig);
$fields->addFieldToTab( 'Root.Content.Modules', $gridField);
return $fields;
}
}
class Program_Controller extends Page_Controller {
}
******** Modules.php **********
class Module extends DataObject {
static $db = array(
'Name' => 'Text'
);
static $belongs_many_many = array(
'Programs' => 'Program'
);
static $summary_fields = array(
'Name' => 'Name'
);
}
I will be really gratefull if you Could you explain where I fail and how you do, please. Greetings