Updated recipes for symfony/framework-bundle.

This commit is contained in:
Jan Böhmer 2020-01-07 19:06:08 +01:00
parent 36f2420cf5
commit 5d98e87e20
8 changed files with 28 additions and 40 deletions

4
.env
View file

@ -15,8 +15,8 @@
###> symfony/framework-bundle ###
APP_ENV=prod
APP_SECRET=7915fd8481d1a52cf42010ebe2caa974
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
APP_SECRET=74893fb247b116fb5d2c45e3b076c20f
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^localhost|example\.com$'
###< symfony/framework-bundle ###

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/

View file

@ -1,10 +1,10 @@
framework:
cache:
# Put the unique name of your app here: the prefix seed
# is used to compute stable namespaces for cache keys.
# Unique name of your app: used to compute stable namespaces for cache keys.
prefix_seed: Part-DB/Part-DB
# The app cache caches to the filesystem by default.
# The "app" cache stores to the filesystem by default.
# The data in this cache should persist between deploys.
# Other options include:
# Redis
@ -18,5 +18,5 @@ framework:
pools:
# Here all things related to cache the tree structures
tree.cache:
adapter: cache.app
tags: true
adapter: cache.app
tags: true

View file

@ -1,13 +1,12 @@
framework:
secret: '%env(APP_SECRET)%'
#default_locale: en
#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.
# Remove or comment this section to explicitly disable session support.
session:
handler_id: ~
handler_id: null
cookie_secure: auto
cookie_samesite: lax

View file

@ -0,0 +1,3 @@
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error

View file

@ -21,7 +21,7 @@
*/
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';

View file

@ -1,27 +1,5 @@
<?php
declare(strict_types=1);
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
@ -35,9 +13,9 @@ class Kernel extends BaseKernel
{
use MicroKernelTrait;
const CONFIG_EXTS = '.{php,xml,yaml,yml}';
private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
public function registerBundles()
public function registerBundles(): iterable
{
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
@ -47,14 +25,20 @@ class Kernel extends BaseKernel
}
}
public function getProjectDir(): string
{
return \dirname(__DIR__);
}
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
$container->setParameter('container.dumper.inline_class_loader', true);
$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
$container->setParameter('container.dumper.inline_factories', true);
$confDir = $this->getProjectDir().'/config';
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
}
@ -63,8 +47,8 @@ class Kernel extends BaseKernel
{
$confDir = $this->getProjectDir().'/config';
$routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
}
}

View file

@ -520,18 +520,19 @@
"version": "v4.2.3"
},
"symfony/framework-bundle": {
"version": "4.2",
"version": "4.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.2",
"ref": "5bb3a8c27df824d195fa68bb635d074854f8498f"
"version": "4.4",
"ref": "23ecaccc551fe2f74baf613811ae529eb07762fa"
},
"files": [
"./config/bootstrap.php",
"./config/packages/cache.yaml",
"./config/packages/framework.yaml",
"./config/packages/test/framework.yaml",
"./config/routes/dev/framework.yaml",
"./config/services.yaml",
"./public/index.php",
"./src/Controller/.gitignore",