Use the new root_path service to make some code more portable

This commit is contained in:
Pierre Rudloff 2021-02-09 22:35:32 +01:00
parent f2be3a7e5b
commit 1e17dff21e
2 changed files with 2 additions and 2 deletions

View file

@ -22,7 +22,7 @@ class ConfigFactory
*/ */
public static function create(Container $container): Config public static function create(Container $container): Config
{ {
$configPath = __DIR__ . '/../../config/config.yml'; $configPath = $container->get('root_path') . '/config/config.yml';
if (is_file($configPath)) { if (is_file($configPath)) {
$config = Config::fromFile($configPath); $config = Config::fromFile($configPath);
} else { } else {

View file

@ -52,7 +52,7 @@ class ViewFactory
$request = $container->get('request'); $request = $container->get('request');
} }
$view = new Smarty(__DIR__ . '/../../templates/'); $view = new Smarty($container->get('root_path') . '/templates/');
/** @var Uri $uri */ /** @var Uri $uri */
$uri = $request->getUri(); $uri = $request->getUri();