diff --git a/lib/Cake/Model/AclNode.php b/lib/Cake/Model/AclNode.php index 313a297bd..e74cb01b9 100644 --- a/lib/Cake/Model/AclNode.php +++ b/lib/Cake/Model/AclNode.php @@ -41,7 +41,7 @@ class AclNode extends AppModel { * * @var array */ - public $actsAs = array('Tree' => array('nested')); + public $actsAs = array('Tree' => array('type' => 'nested')); /** * Constructor diff --git a/lib/Cake/Model/Behavior/AclBehavior.php b/lib/Cake/Model/Behavior/AclBehavior.php index 3d106394b..c5d2380e8 100644 --- a/lib/Cake/Model/Behavior/AclBehavior.php +++ b/lib/Cake/Model/Behavior/AclBehavior.php @@ -36,16 +36,13 @@ class AclBehavior extends ModelBehavior { protected $_typeMaps = array('requester' => 'Aro', 'controlled' => 'Aco', 'both' => array('Aro', 'Aco')); /** - * Sets up the configuation for the model, and loads ACL models if they haven't been already + * Sets up the configuration for the model, and loads ACL models if they haven't been already * * @param Model $model * @param array $config * @return void */ public function setup($model, $config = array()) { - if (is_string($config)) { - $config = array('type' => $config); - } $this->settings[$model->name] = array_merge(array('type' => 'controlled'), (array)$config); $this->settings[$model->name]['type'] = strtolower($this->settings[$model->name]['type']); diff --git a/lib/Cake/Model/Behavior/ContainableBehavior.php b/lib/Cake/Model/Behavior/ContainableBehavior.php index 9c057f40b..f76d2f8d2 100644 --- a/lib/Cake/Model/Behavior/ContainableBehavior.php +++ b/lib/Cake/Model/Behavior/ContainableBehavior.php @@ -64,9 +64,6 @@ class ContainableBehavior extends ModelBehavior { if (!isset($this->settings[$Model->alias])) { $this->settings[$Model->alias] = array('recursive' => true, 'notices' => true, 'autoFields' => true); } - if (!is_array($settings)) { - $settings = array(); - } $this->settings[$Model->alias] = array_merge($this->settings[$Model->alias], $settings); } diff --git a/lib/Cake/Model/Behavior/TreeBehavior.php b/lib/Cake/Model/Behavior/TreeBehavior.php index dc1aa8cf3..d5a866fbc 100644 --- a/lib/Cake/Model/Behavior/TreeBehavior.php +++ b/lib/Cake/Model/Behavior/TreeBehavior.php @@ -55,9 +55,6 @@ class TreeBehavior extends ModelBehavior { * @return void */ public function setup($Model, $config = array()) { - if (!is_array($config)) { - $config = array('type' => $config); - } $settings = array_merge($this->_defaults, $config); if (in_array($settings['scope'], $Model->getAssociated('belongsTo'))) { diff --git a/lib/Cake/Test/Case/Model/Behavior/AclBehaviorTest.php b/lib/Cake/Test/Case/Model/Behavior/AclBehaviorTest.php index a4ebef417..cdaed2bca 100644 --- a/lib/Cake/Test/Case/Model/Behavior/AclBehaviorTest.php +++ b/lib/Cake/Test/Case/Model/Behavior/AclBehaviorTest.php @@ -53,7 +53,7 @@ class AclPerson extends CakeTestModel { * * @var array */ - public $actsAs = array('Acl' => 'both'); + public $actsAs = array('Acl' => array('type' => 'both')); /** * belongsTo property @@ -128,7 +128,7 @@ class AclUser extends CakeTestModel { * * @var array */ - public $actsAs = array('Acl' => 'requester'); + public $actsAs = array('Acl' => array('type' => 'requester')); /** * parentNode @@ -166,7 +166,7 @@ class AclPost extends CakeTestModel { * * @var array */ - public $actsAs = array('Acl' => 'Controlled'); + public $actsAs = array('Acl' => array('type' => 'Controlled')); /** * parentNode diff --git a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php index 92d1ad009..a7dbc1312 100644 --- a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php +++ b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php @@ -402,6 +402,16 @@ class ObjectCollectionTest extends CakeTestCase { 'Apple' => array('class' => 'Banana.Apple', 'settings' => array('foo' => 'bar')), ); $this->assertEquals($expected, $result); + + // This is the result after Controller::_mergeVars + $components = array( + 'Html' => null, + 'Foo.Bar' => array('one', 'two'), + 'Something' => null, + 'Banana.Apple' => array('foo' => 'bar') + ); + $result = ObjectCollection::normalizeObjectArray($components); + $this->assertEquals($expected, $result); } } \ No newline at end of file diff --git a/lib/Cake/Utility/ObjectCollection.php b/lib/Cake/Utility/ObjectCollection.php index 2b6c68510..9406b76c6 100644 --- a/lib/Cake/Utility/ObjectCollection.php +++ b/lib/Cake/Utility/ObjectCollection.php @@ -247,7 +247,8 @@ abstract class ObjectCollection { foreach ($objects as $i => $objectName) { $options = array(); if (!is_int($i)) { - list($options, $objectName) = array($objectName, $i); + $options = (array)$objectName; + $objectName = $i; } list($plugin, $name) = pluginSplit($objectName); $normal[$name] = array('class' => $objectName, 'settings' => $options);