Browse Source

Keeping BC on short syntax for Acl and Tree behavior.

Renan Gonçalves 14 years ago
parent
commit
229bf8e984

+ 5 - 1
lib/Cake/Model/Behavior/AclBehavior.php

@@ -43,7 +43,11 @@ class AclBehavior extends ModelBehavior {
  * @return void
  */
 	public function setup($model, $config = array()) {
-		$this->settings[$model->name] = array_merge(array('type' => 'controlled'), (array)$config);
+		if (isset($config[0])) {
+			$config['type'] = $config[0];
+			unset($config[0]);
+		}
+		$this->settings[$model->name] = array_merge(array('type' => 'controlled'), $config);
 		$this->settings[$model->name]['type'] = strtolower($this->settings[$model->name]['type']);
 
 		$types = $this->_typeMaps[$this->settings[$model->name]['type']];

+ 4 - 0
lib/Cake/Model/Behavior/TreeBehavior.php

@@ -55,6 +55,10 @@ class TreeBehavior extends ModelBehavior {
  * @return void
  */
 	public function setup($Model, $config = array()) {
+		if (isset($config[0])) {
+			$config['type'] = $config[0];
+			unset($config[0]);
+		}
 		$settings = array_merge($this->_defaults, $config);
 
 		if (in_array($settings['scope'], $Model->getAssociated('belongsTo'))) {

+ 1 - 1
lib/Cake/Test/Case/Model/Behavior/AclBehaviorTest.php

@@ -53,7 +53,7 @@ class AclPerson extends CakeTestModel {
  *
  * @var array
  */
-	public $actsAs = array('Acl' => array('type' => 'both'));
+	public $actsAs = array('Acl' => 'both');
 
 /**
  * belongsTo property