From 231e3f0003c1b77d4d97b1a97833406856dc08ec Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 9 Nov 2008 14:34:05 +0000 Subject: [PATCH] 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 --- code/ModelAdmin.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/ModelAdmin.php b/code/ModelAdmin.php index 78a851f8..6c44bf32 100644 --- a/code/ModelAdmin.php +++ b/code/ModelAdmin.php @@ -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"',