I have this uri di in config/services.php
use Phalcon\DI\FactoryDefault;
use Phalcon\Mvc\Url as UrlResolver;
$di = new FactoryDefault();
/**
* The URL component is used to generate all kind of urls in the application
*/
$di->set('url', function () use ($config) {
$url = new UrlResolver();
$url->setBaseUri($config->application->baseUri);
return $url;
});
/**
* add router support.
*/
$di->set('router', function() {
include __DIR__.'/router.php';
return $router;
});
In my router.
$router = new Phalcon\Mvc\Router();
$router->removeExtraSlashes(true);
$router->add(
'/{lang:[a-z]{2}}/index/test2',
array(
'controller' => 2,
'action' => 3,
)
)->setName('test2');
In my controller
echo $url->get(
array(
'for' => 'test2',
)
);
Results: A dependency injector container is required to obtain the "url" service
How do i make it work? Is this bug?