I'm trying to get the name of the active handler for an incoming request to my Phalcon\Mvc\Micro application so I can get annotations for it. I'm lazy loading the Handler Collections so (to my understanding) this should be initialized as soon as it is first accessed. Therefore, I'm trying to get the name of the controller and the name of the handling function like this:
$annotations = $app->annotations->getMethod( $app->getActiveHandler(), //the required controller $app->getActiveHandler() //the required method );
However, this is not working. When I run:
I get the following output:
Array (  => Phalcon\Mvc\Micro\LazyLoader Object ( [_handler:protected] => [_definition:protected] => UsersController )  => getAll )
The function is correctly loaded ("getAll") but the controller isn't. When I turn off lazy loading for this handler and do the same thing, I get:
Array (  => UsersController  => getAll )
Am I doing something wrong? Is there some way to manipulate the LazyLoader Object to get the data I want? I tried to figure this out from the documentation but I wasn't able to.
I could just turn off lazy loading, but my API has lots of different handlers that I would prefer not to load when not used.
Any help would be greatly appreciated!