I'm looking for a solution that will allow me to generate urls using Phalcon\Mvc\Url for \Phalcon\Mvc\Micro\Collection (using a controller as a handler).
This is my collection setup
$app = new \Phalcon\Mvc\Micro($di); //$di contains my url service
$nappiCollection = new \Phalcon\Mvc\Micro\Collection();
$nappiCollection
->setPrefix('/v1/nappi')
->setHandler('\PhalconRest\Controllers\NappiController')
->setLazy(true);
$nappiCollection->get('/{id:[0-9]+}', 'show');
$app->mount($nappiCollection);
I basically want to be able to do this:
$nappiCollection->get('/{id:[0-9]+}', 'show')->setName('show-nappi')
and then generate a url like this:
$app->url->get(array(
'for' => 'show-nappi',
)),
unfortunately \Phalcon\Mvc\Micro\Collection does not have a setName method. How should I deal with this?