Fatal error: Uncaught exception 'Zend_Acl_Role_Registry_Exception' with message 'Role 'admin' not found

1.2k views Asked by At

ZEND FRAMEWORL: I have this error when coding my ACL. how can I solve this? I already have a database with a data field role. I don't know the problem

Fatal error: Uncaught exception 'Zend_Acl_Role_Registry_Exception' with message 'Role 'admin' not found' in C:\xampp\htdocs\zend3\zend3\library\Zend\Acl\Role\Registry.php:132 Stack trace: #0 C:\xampp\htdocs\zend3\zend3\library\Zend\Acl.php(837): Zend_Acl_Role_Registry->get('admin') #1 this is my bootstrap.php

1

There are 1 answers

0
Richard Parnaby-King On

Without seeing some sample code, it appears as though you are attempting to assign a 'role' to a 'resource' without having defined the 'role'.

Here is a basic example of setting up ACL.

$acl = new Zend_Acl();
$acl->addRole(new Zend_Acl_Role('admin'));
$acl->add(new Zend_Acl_Resource('someResource'));
$acl->allow('admin', 'someResource');

Your error message is saying you have missed the second line of code ($acl->addRole(...);)

Zend ACL Introduction