Keeping BC on short syntax for Acl and Tree behavior.

This commit is contained in:
Renan Gonçalves 2011-10-16 12:06:41 +02:00
parent 3a04bb4733
commit 229bf8e984
3 changed files with 10 additions and 2 deletions

View file

@ -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']];

View file

@ -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'))) {

View file

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