I want to load resources from database inside the ACL plugin
I make like this
class My_ACL extends Zend_Acl {
protected $_role_id;
protected $_userResource;
public function __construct() {
try {
$db = Zend_Db_Table::getDefaultAdapter();
$stmt = $db->query("CALL getUserPrivileges(?)", 998877445);
//Returns an array containing all of the result set rows
$rows = $stmt->fetchAll();
$stmt->closeCursor();
print_r($rows);
return $rows;
} catch (Exception $e) {
echo 'error ' . $e;
}
}
but this doesn’t work since white page is rendered and nothing is print out!
I found the problem. The problem was calling default data adapter before initializing the default adapter, the trick was I have to get the data adapter inside the bootstrap and pass it to the plugin, so I make like this
in bootstrap file
and in the Application_Plugin_Acl, I make like this
and here’s my_ACL