I'm trying to manage a Versioned DataObject in ModelAdmin as soon as I make the Object versioned I get the following error in the Model Admin
[Warning] array_flip() expects parameter 1 to be array, null given
Any Ideas?
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
I'm trying to manage a Versioned DataObject in ModelAdmin as soon as I make the Object versioned I get the following error in the Model Admin
[Warning] array_flip() expects parameter 1 to be array, null given
Any Ideas?
Same issue here. I narrowed it down to the fact that my DataObject didn't have a has_one relationship (the offending line is looking for has_one IDs):
[Warning] array_flip() expects parameter 1 to be array, null given
GET /admin/tests/Test/EditForm/field/Test/item/2/edit
Line 1374 in C:\wamp\www\framework\model\DataObject.php
To avoid the bug, the class being extended by Versioned must have a has_one relationship to either itself or another DataObject.
This code works:
class Test extends DataObject {
static $has_one = array(
'Image' => 'Image'
);
static $extensions = array(
'Versioned'
);
}
Whereas this code doesn't:
class Test extends DataObject {
static $extensions = array(
'Versioned'
);
}
Same results when using the usual Object::add_extension method.
Could anyone shed some light on why a has_one relationship is necessary?
Not sure if you are still having this issue, but take a look at
https://github.com/icecaster/silverstripe-versioned-gridfield
Cheers!