Hi,
i want to create an "Reminder" extension.
In our project are many custom DataObjects handled inside ModelAdmin.
To some of them i want to add a "Reminder" functionality.
I decided to create a DataObjectDecorator, but i get errors.
Here are the code Snippets:
The Reminder DataObject itself:
class Reminder extends DataObject {
public static $db = array(
'Title' => 'Varchar(256)',
'Deadline' => 'SS_Datetime',
'Message' => 'HTMLText',
'Priority' => 'Enum("low,medium,high","medium")'
);
public static $has_one = array(
);
}
The Decorator:
class ReminderExtension extends DataObjectDecorator {
function extraStatics() {
return array(
'has_many' => array(
'Reminders' => 'Reminder'
));
}
public function updateCMSFields(FieldSet $fields) {
$table = new HasManyDataObjectManager($this->owner, 'Reminders', 'Reminder', array('Title' => 'Title'));
$fields->addFieldToTab('Root.Content.Reminders', $table);
}
}
And inside of some Dataobjects i deine the extension/the decorator
static $extensions = array(
'ReminderExtension'
);
But when klicking inside ModelAdmin of an Dataobject to edit:
Warning: "array_flip() [function.array-flip]: The argument should be an array" at line 1334 of....../html/sapphire/core/model/DataObject.php
I am working with SS 2.4.1
Any ideas ?