Hi there. I'm trying to port a project from Zend to Phalcon. One thing the original author did is to check the permissions for the requested URL in a custom ACL script, which I'd prefer to not touch (big chaotic magic inside). Now I'm trying to pass some data from the index.php to this ACL script. In index.php I'm doing:
$reg = new \Phalcon\Registry(); $reg->config = $config;
Now inside my Module.php I do have this code:
$dependencyInjector->set('dispatcher', function () { $dispatcher = new Dispatcher();
$eventsManager = new \Phalcon\Events\Manager(); $eventsManager->attach("dispatch:beforeDispatch", function($event, $dispatcher) { require_once APPLICATION_PATH . "/plugins/acl.php"; });
(...)
Last but not least inside the acl.php file I do have this code:
$reg = new \Phalcon\Registry(); var_dump($reg->config);
However, the var_dump returns NULL. Looking at the $reg object, it is completly empty. However, when I skip this part and get into the IndexController, the exact same command returns the config object. Isn'tit possible to access the registry in the Dispatcher or am I missing something obvious?
Thanks and regards,
Patrick