Skip to content

Commit

Permalink
mvc: fix Phalcon 5.4 and up
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Mar 12, 2024
1 parent 519f4cb commit 7dde119
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/opnsense/mvc/app/config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@
/**
* Setup router
*/
$di->set('router', function () use ($config) {
$di->set('router', function () use ($config, $di) {
$routing = new Routing($config->application->controllersDir, "ui");
$routing->getRouter()->handle($_SERVER['REQUEST_URI']);
return $routing->getRouter();
$router = $routing->getRouter();
$router->setDI($di);
$router->handle($_SERVER['REQUEST_URI']);
return $router;
});
8 changes: 5 additions & 3 deletions src/opnsense/mvc/app/config/services_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@
/**
* Setup router
*/
$di->set('router', function () use ($config) {
$di->set('router', function () use ($config, $di) {
$routing = new Routing($config->application->controllersDir, "api");
$routing->getRouter()->handle($_SERVER['REQUEST_URI']);
return $routing->getRouter();
$router = $routing->getRouter();
$router->setDI($di);
$router->handle($_SERVER['REQUEST_URI']);
return $router;
});

// exception handling
Expand Down

0 comments on commit 7dde119

Please sign in to comment.