diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 6089f4bd..dba8bd8e 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -1,6 +1,7 @@ +# see https://symfony.com/doc/current/reference/configuration/framework.html framework: secret: '%env(APP_SECRET)%' - #csrf_protection: true + csrf_protection: true #http_method_override: true # Enables session support. Note that the session will ONLY be started if you read or write from it. diff --git a/src/Kernel.php b/src/Kernel.php index b63891b9..261030ec 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -15,17 +15,27 @@ class Kernel extends BaseKernel { $container->import('../config/{packages}/*.yaml'); $container->import('../config/{packages}/'.$this->environment.'/*.yaml'); - $container->import('../config/{services}.yaml'); - $container->import('../config/{services}_'.$this->environment.'.yaml'); - //Add parameter file + //Add parameters.yml $container->import('../config/parameters.yaml'); + + if (is_file(\dirname(__DIR__).'/config/services.yaml')) { + $container->import('../config/{services}.yaml'); + $container->import('../config/{services}_'.$this->environment.'.yaml'); + } elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) { + (require $path)($container->withPath($path), $this); + } } protected function configureRoutes(RoutingConfigurator $routes): void { $routes->import('../config/{routes}/'.$this->environment.'/*.yaml'); $routes->import('../config/{routes}/*.yaml'); - $routes->import('../config/{routes}.yaml'); + + if (is_file(\dirname(__DIR__).'/config/routes.yaml')) { + $routes->import('../config/{routes}.yaml'); + } elseif (is_file($path = \dirname(__DIR__).'/config/routes.php')) { + (require $path)($routes->withPath($path), $this); + } } } diff --git a/symfony.lock b/symfony.lock index 13b9c973..15ee0f23 100644 --- a/symfony.lock +++ b/symfony.lock @@ -204,7 +204,7 @@ "repo": "github.com/symfony/recipes-contrib", "branch": "master", "version": "1.8", - "ref": "1d42bc3f713130582e6e0c475c49bc327ab0a2a2" + "ref": "5a5bdc2d0e2533ed6935d5ae562f2b318a8fc1ee" }, "files": [ "./config/packages/liip_imagine.yaml", @@ -581,7 +581,7 @@ "repo": "github.com/symfony/recipes", "branch": "master", "version": "5.1", - "ref": "37b4ec59eda3eb89705f21a0da7231862495ce0a" + "ref": "ffcb76bab779154c0a7d8cddb9f448c2c45a4e50" }, "files": [ "./config/packages/cache.yaml",