mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-12 15:06:27 +00:00
Keeping BC on short syntax for Acl and Tree behavior.
This commit is contained in:
parent
3a04bb4733
commit
229bf8e984
3 changed files with 10 additions and 2 deletions
|
@ -43,7 +43,11 @@ class AclBehavior extends ModelBehavior {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setup($model, $config = array()) {
|
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']);
|
$this->settings[$model->name]['type'] = strtolower($this->settings[$model->name]['type']);
|
||||||
|
|
||||||
$types = $this->_typeMaps[$this->settings[$model->name]['type']];
|
$types = $this->_typeMaps[$this->settings[$model->name]['type']];
|
||||||
|
|
|
@ -55,6 +55,10 @@ class TreeBehavior extends ModelBehavior {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setup($Model, $config = array()) {
|
public function setup($Model, $config = array()) {
|
||||||
|
if (isset($config[0])) {
|
||||||
|
$config['type'] = $config[0];
|
||||||
|
unset($config[0]);
|
||||||
|
}
|
||||||
$settings = array_merge($this->_defaults, $config);
|
$settings = array_merge($this->_defaults, $config);
|
||||||
|
|
||||||
if (in_array($settings['scope'], $Model->getAssociated('belongsTo'))) {
|
if (in_array($settings['scope'], $Model->getAssociated('belongsTo'))) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ class AclPerson extends CakeTestModel {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $actsAs = array('Acl' => array('type' => 'both'));
|
public $actsAs = array('Acl' => 'both');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* belongsTo property
|
* belongsTo property
|
||||||
|
|
Loading…
Add table
Reference in a new issue