Skip to content

Commit 8f87330

Browse files
committed
#1305 - Add 'router' service to all projects
1 parent 2aee5f0 commit 8f87330

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

templates/project/micro/services.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,14 @@
5656
return $connection;
5757
});
5858

59+
/**
60+
* Register router
61+
*/
62+
$di->setShared('router', function () {
63+
$router = new \Phalcon\Mvc\Router();
64+
$router->setUriSource(
65+
\Phalcon\Mvc\Router::URI_SOURCE_SERVER_REQUEST_URI
66+
);
67+
68+
return $router;
69+
});

templates/project/modules/services_web.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
$router = new Router();
1616

1717
$router->setDefaultModule('frontend');
18+
$router->setUriSource(
19+
Router::URI_SOURCE_SERVER_REQUEST_URI
20+
);
1821

1922
return $router;
2023
});

templates/project/simple/services.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use Phalcon\Mvc\Router;
34
use Phalcon\Mvc\View;
45
use Phalcon\Mvc\View\Engine\Php as PhpEngine;
56
use Phalcon\Mvc\Url as UrlResolver;
@@ -110,3 +111,15 @@
110111

111112
return $session;
112113
});
114+
115+
/**
116+
* Register router
117+
*/
118+
$di->setShared('router', function () {
119+
$router = new Router();
120+
$router->setUriSource(
121+
Router::URI_SOURCE_SERVER_REQUEST_URI
122+
);
123+
124+
return $router;
125+
});

0 commit comments

Comments
 (0)