views:

40

answers:

2

I'm following the ACL tutorial for CakePHP 1.3 and I was wondering if there is a functional difference between declaring a behavior like this:

var $actsAs = array('Acl' => 'requester');

and like this:

var $actsAs = array('Acl' => array('type' => 'requester'));
A: 

There is no difference. You can even declare this way:

var $actsAs = array('Acl' => array('requester'));
bancer
Cool. Thanks for clarifying and for the link also.
Jonnie
-1 - misleading and possibly frustratingly so
michaelc
A: 

Though your two examples are both valid and correct for CakePHP 1.3.4 (cake/libs/model/behaviors/acl.php lines 48-51), the suggested third method posted by bancer is not correct. Because the AclBehavior defaults to 'requester' when it cannot find the configuration, this is a potentially frustrating bug in that it will work as expected until you attempt to change the type to 'controlled'. (it also doesn't work in CakePHP 1.2 - Mark Story made a change to that line at the advice of an anonymous user.) If you do want to replace your third example, var $actsAs = array('Acl'); should do fine (unless you want type to be 'controlled', but you can then see to add the option).

michaelc
bancer
Evidence of popularity doesn't make it correct friend :).
michaelc