Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Keeping BC on short syntax for Acl and Tree behavior.
  • Loading branch information
renan committed Oct 16, 2011
1 parent 3a04bb4 commit 229bf8e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/Cake/Model/Behavior/AclBehavior.php
Expand Up @@ -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']];
Expand Down
4 changes: 4 additions & 0 deletions lib/Cake/Model/Behavior/TreeBehavior.php
Expand Up @@ -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'))) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Model/Behavior/AclBehaviorTest.php
Expand Up @@ -53,7 +53,7 @@ class AclPerson extends CakeTestModel {
*
* @var array
*/
public $actsAs = array('Acl' => array('type' => 'both'));
public $actsAs = array('Acl' => 'both');

/**
* belongsTo property
Expand Down

0 comments on commit 229bf8e

Please sign in to comment.