I am trying to use GridField to allow CMS users to add information (Mailing Lists) to an article of the same page type (Shows) but every new page that's created is already populated with information from previous articles.
I think it may have something to do with the way I've set up the relationships between the Shows page type and the Mailing List DataObject but I can't figure out what I need to do for every new show page to have it's own blank GridField as the mailing list isn't the same for every show...
I've tried many combinations of $has_one, $has_many & $many_many on the two files but nothing gets it working the way I need it to which is for every Show page to have it's own GridField (Mailing List)...
The code I have at the moment is:
Shows.php
private static $has_many = array(
'MailingLists' => 'MailingList'
);
...
$config = GridFieldConfig_RelationEditor::create();
$gridField = new GridField('MailingList',
'Shows Mailing List',
new DataList('MailingList'),
$config
);
$fields->addFieldsToTab('Root.Content.MailingList', array(
$gridField
));
MailingList.php
class MailingList extends DataObject {
private static $db = array(
'Title' => 'Varchar(25)',
'Description' => 'Varchar(55)'
);
private static $has_one = array(
'Shows' => 'Shows'
);
}