We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Adapter\Memory->addRole() accessInherits error

Phpdocs on Phalcon\Acl\Adapter\Memory->addRole() says that $accessInherits may be array or string. Phpdocs on Phalcon\Acl\AdapterInterface->addRole() says that $accessInherits may be array. But when I call this function like this: $acl->addRole(new Acl\Role('MyRole'), ['SomeRole', 'AnotherRole']);

I received an error: Notice: Array to string conversion in ... Role 'Array' (to inherit) does not exist in the role list

Is it a bug?



98.9k

Maybe the method signature in the docs is wrong, this method doesn't support an array as parameter only an string name

It's not a good news :( Can you update phpdocs in devtools?



98.9k

You can use:

$acl->addInherit('MyRole', 'SomeRole');
$acl->addInherit('MyRole', 'AnotherRole');