mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
ENHANCEMENT Allowing strings instead of arrays in ModelAdmin::$managed_models to make it less error-prone for beginners
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@65463 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
6db9650b32
commit
231e3f0003
@ -34,7 +34,7 @@ abstract class ModelAdmin extends LeftAndMain {
|
||||
/**
|
||||
* List of all managed {@link DataObject}s in this interface.
|
||||
*
|
||||
* @var array
|
||||
* @var array|string
|
||||
*/
|
||||
protected static $managed_models = null;
|
||||
|
||||
@ -195,6 +195,7 @@ abstract class ModelAdmin extends LeftAndMain {
|
||||
*/
|
||||
protected function getManagedModels() {
|
||||
$models = $this->stat('managed_models');
|
||||
if(is_string($models)) $models = array($models);
|
||||
if(!count($models)) user_error('ModelAdmin::getManagedModels():
|
||||
You need to specify at least one DataObject subclass in protected static $managed_models.
|
||||
Make sure the visibility of your property is set to "protected"',
|
||||
|
Loading…
Reference in New Issue
Block a user