From 1e17dff21e9f8ac174eebf84027d93898f2243ce Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 9 Feb 2021 22:35:32 +0100 Subject: [PATCH] Use the new root_path service to make some code more portable --- classes/Factory/ConfigFactory.php | 2 +- classes/Factory/ViewFactory.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Factory/ConfigFactory.php b/classes/Factory/ConfigFactory.php index c408b0e..beab456 100644 --- a/classes/Factory/ConfigFactory.php +++ b/classes/Factory/ConfigFactory.php @@ -22,7 +22,7 @@ class ConfigFactory */ public static function create(Container $container): Config { - $configPath = __DIR__ . '/../../config/config.yml'; + $configPath = $container->get('root_path') . '/config/config.yml'; if (is_file($configPath)) { $config = Config::fromFile($configPath); } else { diff --git a/classes/Factory/ViewFactory.php b/classes/Factory/ViewFactory.php index e941663..591369d 100644 --- a/classes/Factory/ViewFactory.php +++ b/classes/Factory/ViewFactory.php @@ -52,7 +52,7 @@ class ViewFactory $request = $container->get('request'); } - $view = new Smarty(__DIR__ . '/../../templates/'); + $view = new Smarty($container->get('root_path') . '/templates/'); /** @var Uri $uri */ $uri = $request->getUri();