Update to symfony 5.1

This commit is contained in:
Timothy Warren 2020-06-02 16:08:08 -04:00
parent 9fe4411a77
commit b78118790c
18 changed files with 2966 additions and 1567 deletions

View File

@ -2,18 +2,21 @@
"type": "project", "type": "project",
"license": "proprietary", "license": "proprietary",
"require": { "require": {
"php": "^7.2.0", "php": "^7.4.0",
"sensio/framework-extra-bundle": "^5.2", "sensio/framework-extra-bundle": "^5.2",
"symfony/debug-pack": "^1.0", "symfony/debug-pack": "^1.0",
"symfony/form": "^4.0", "symfony/form": "^5.1",
"symfony/maker-bundle": "^1.0", "symfony/maker-bundle": "^1.0",
"symfony/orm-pack": "^1.0", "symfony/orm-pack": "^1.0",
"symfony/translation": "^4.3", "symfony/translation": "^5.1",
"symfony/validator": "^4.3" "symfony/twig-pack": "1.0.0",
"symfony/validator": "^5.1",
"symfony/yaml": "^5.1"
}, },
"require-dev": { "require-dev": {
"roave/security-advisories": "dev-master", "roave/security-advisories": "dev-master",
"symfony/dotenv": "^4.0", "symfony/debug": "^4.4.9",
"symfony/dotenv": "^5.1",
"symfony/flex": "^1.0" "symfony/flex": "^1.0"
}, },
"config": { "config": {
@ -46,8 +49,8 @@
}, },
"conflict": { "conflict": {
"symfony/symfony": "*", "symfony/symfony": "*",
"symfony/twig-bundle": "<3.3", "symfony/twig-bundle": "<4.4",
"symfony/debug": "<3.3" "symfony/debug": "<4.4"
}, },
"extra": { "extra": {
"symfony": { "symfony": {

4270
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,6 @@
return [ return [
App\App::class => ['all' => true], App\App::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
@ -12,4 +11,5 @@ return [
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
]; ];

View File

@ -19,7 +19,7 @@ doctrine:
url: '%env(DATABASE_URL)%' url: '%env(DATABASE_URL)%'
orm: orm:
auto_generate_proxy_classes: '%kernel.debug%' auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore #naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true auto_mapping: true
mappings: mappings:
App: App:

View File

@ -1,3 +1,4 @@
framework: framework:
router: router:
strict_requirements: ~ strict_requirements: ~
utf8: true

View File

@ -3,3 +3,4 @@ twig:
paths: ['%kernel.project_dir%/templates'] paths: ['%kernel.project_dir%/templates']
debug: '%kernel.debug%' debug: '%kernel.debug%'
strict_variables: '%kernel.debug%' strict_variables: '%kernel.debug%'
exception_controller: null

View File

@ -1,3 +1,3 @@
controllers: controllers:
resource: ../src/Controller/ resource: '../../src/Controller/'
type: annotation type: annotation

View File

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

View File

@ -26,7 +26,6 @@ services:
# and have a tag that allows actions to type-hint services # and have a tag that allows actions to type-hint services
App\Controller\: App\Controller\:
resource: '../src/Controller' resource: '../src/Controller'
public: true
tags: ['controller.service_arguments'] tags: ['controller.service_arguments']
# add more services, or override services that need manual wiring # add more services, or override services that need manual wiring

View File

@ -1,29 +1,29 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
use App\Kernel; use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv; use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
require __DIR__ . '/../vendor/autoload.php'; require dirname(__DIR__).'/vendor/autoload.php';
// Parse env file (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
(new Dotenv())->load(__DIR__ . '/../.env');
// Set environment if ($_SERVER['APP_DEBUG']) {
$_SERVER['APP_ENV'] = 'dev';
$_SERVER['APP_DEBUG'] = true;
if ($_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev'))) {
umask(0000); umask(0000);
Debug::enable(); Debug::enable();
} }
// Request::setTrustedProxies(['0.0.0.0/0'], Request::HEADER_FORWARDED); if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
$kernel = new Kernel('dev', true); if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals(); $request = Request::createFromGlobals();
$response = $kernel->handle($request); $response = $kernel->handle($request);
$response->send(); $response->send();

View File

@ -1,9 +0,0 @@
<?php declare(strict_types=1);
namespace App;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class App extends Bundle
{
}

View File

@ -6,6 +6,7 @@ use App\Entity\Camera;
use App\Form\CameraType; use App\Form\CameraType;
use Doctrine\ORM\ORMInvalidArgumentException; use Doctrine\ORM\ORMInvalidArgumentException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
@ -28,7 +29,7 @@ class CameraController extends AbstractController
* *
* @Route("/", name="camera_index", methods={"GET"}) * @Route("/", name="camera_index", methods={"GET"})
*/ */
public function indexAction() public function indexAction(): Response
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
@ -120,7 +121,7 @@ class CameraController extends AbstractController
* *
* @param Camera $camera The camera entity * @param Camera $camera The camera entity
* *
* @return \Symfony\Component\Form\FormInterface The form * @return FormInterface The form
*/ */
private function createDeleteForm(Camera $camera): FormInterface private function createDeleteForm(Camera $camera): FormInterface
{ {

View File

@ -3,6 +3,7 @@
namespace App\Controller; namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -11,7 +12,7 @@ class DefaultController extends AbstractController
/** /**
* @Route("/", name="homepage") * @Route("/", name="homepage")
*/ */
public function indexAction(Request $request) public function indexAction(Request $request): Response
{ {
// replace this example code with whatever you need // replace this example code with whatever you need
return $this->render('default/index.html.twig', [ return $this->render('default/index.html.twig', [

View File

@ -6,6 +6,7 @@ use App\Entity\Film;
use App\Form\FilmType; use App\Form\FilmType;
use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Criteria;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -27,7 +28,7 @@ class FilmController extends AbstractController
* *
* @Route("/", name="film_index", methods={"GET"}) * @Route("/", name="film_index", methods={"GET"})
*/ */
public function indexAction() public function indexAction(): Response
{ {
$repo = $this->getDoctrine()->getManager()->getRepository(self::ENTITY); $repo = $this->getDoctrine()->getManager()->getRepository(self::ENTITY);
@ -104,7 +105,7 @@ class FilmController extends AbstractController
* *
* @param Film $film The film entity * @param Film $film The film entity
* *
* @return \Symfony\Component\Form\FormInterface The form * @return FormInterface The form
*/ */
private function createDeleteForm(Film $film): FormInterface private function createDeleteForm(Film $film): FormInterface
{ {

View File

@ -1,64 +1,37 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App; namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel class Kernel extends BaseKernel
{ {
use MicroKernelTrait; use MicroKernelTrait;
const CONFIG_EXTS = '.{php,xml,yaml,yml}'; protected function configureContainer(ContainerConfigurator $container): void
protected $loadClassCache = FALSE;
public function getCacheDir()
{ {
//return '/dev/null'; $container->import('../config/{packages}/*.yaml');
return $this->getProjectDir().'/var/cache/'.$this->environment; $container->import('../config/{packages}/'.$this->environment.'/*.yaml');
$container->import('../config/{services}.yaml');
$container->import('../config/{services}_'.$this->environment.'.yaml');
} }
public function getLogDir() protected function configureRoutes(RoutingConfigurator $routes): void
{ {
return $this->getProjectDir().'/var/log'; $routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
} $routes->import('../config/{routes}/*.yaml');
$routes->import('../config/{routes}.yaml');
public function registerBundles()
{
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
if (isset($envs['all']) || isset($envs[$this->environment])) {
yield new $class();
}
}
}
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
{
$container->setParameter('container.autowiring.strict_mode', true);
$container->setParameter('container.dumper.inline_class_loader', true);
$confDir = $this->getProjectDir().'/config';
$loader->load($confDir.'/packages/*'.self::CONFIG_EXTS, 'glob');
if (is_dir($confDir.'/packages/'.$this->environment)) {
$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');
}
protected function configureRoutes(RouteCollectionBuilder $routes)
{
$confDir = $this->getProjectDir().'/config';
if (is_dir($confDir.'/routes/')) {
$routes->import($confDir.'/routes/*'.self::CONFIG_EXTS, '/', 'glob');
}
if (is_dir($confDir.'/routes/'.$this->environment)) {
$routes->import($confDir.'/routes/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
}
$routes->import($confDir.'/routes'.self::CONFIG_EXTS, '/', 'glob');
} }
} }

View File

@ -29,9 +29,6 @@
"ref": "44d3aa7752dd46f77ba11af2297a25e1dedfb4d0" "ref": "44d3aa7752dd46f77ba11af2297a25e1dedfb4d0"
} }
}, },
"doctrine/doctrine-cache-bundle": {
"version": "1.3.2"
},
"doctrine/doctrine-migrations-bundle": { "doctrine/doctrine-migrations-bundle": {
"version": "1.2", "version": "1.2",
"recipe": { "recipe": {
@ -65,17 +62,17 @@
"doctrine/reflection": { "doctrine/reflection": {
"version": "v1.0.0" "version": "v1.0.0"
}, },
"easycorp/easy-log-handler": { "doctrine/sql-formatter": {
"version": "1.0", "version": "1.0.1"
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "70062abc2cd58794d2a90274502f81b55cd9951b"
}
}, },
"jdorn/sql-formatter": { "laminas/laminas-code": {
"version": "v1.2.17" "version": "3.4.1"
},
"laminas/laminas-eventmanager": {
"version": "3.2.1"
},
"laminas/laminas-zendframework-bridge": {
"version": "1.0.0"
}, },
"monolog/monolog": { "monolog/monolog": {
"version": "1.23.0" "version": "1.23.0"
@ -89,12 +86,18 @@
"ocramius/proxy-manager": { "ocramius/proxy-manager": {
"version": "2.2.0" "version": "2.2.0"
}, },
"php": {
"version": "7.4"
},
"psr/cache": { "psr/cache": {
"version": "1.0.1" "version": "1.0.1"
}, },
"psr/container": { "psr/container": {
"version": "1.0.0" "version": "1.0.0"
}, },
"psr/event-dispatcher": {
"version": "1.0.0"
},
"psr/log": { "psr/log": {
"version": "1.0.2" "version": "1.0.2"
}, },
@ -129,7 +132,7 @@
} }
}, },
"symfony/debug": { "symfony/debug": {
"version": "v3.3.13" "version": "v4.4.9"
}, },
"symfony/debug-bundle": { "symfony/debug-bundle": {
"version": "4.1", "version": "4.1",
@ -146,12 +149,18 @@
"symfony/dependency-injection": { "symfony/dependency-injection": {
"version": "v3.3.13" "version": "v3.3.13"
}, },
"symfony/deprecation-contracts": {
"version": "v2.1.2"
},
"symfony/doctrine-bridge": { "symfony/doctrine-bridge": {
"version": "v4.0.0" "version": "v4.0.0"
}, },
"symfony/dotenv": { "symfony/dotenv": {
"version": "v3.3.13" "version": "v3.3.13"
}, },
"symfony/error-handler": {
"version": "v4.4.0"
},
"symfony/event-dispatcher": { "symfony/event-dispatcher": {
"version": "v3.3.13" "version": "v3.3.13"
}, },
@ -206,9 +215,6 @@
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f" "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
} }
}, },
"symfony/mime": {
"version": "v4.3.0"
},
"symfony/monolog-bridge": { "symfony/monolog-bridge": {
"version": "v4.1.1" "version": "v4.1.1"
}, },
@ -230,27 +236,33 @@
"symfony/polyfill-ctype": { "symfony/polyfill-ctype": {
"version": "v1.8.0" "version": "v1.8.0"
}, },
"symfony/polyfill-intl-grapheme": {
"version": "v1.17.0"
},
"symfony/polyfill-intl-icu": { "symfony/polyfill-intl-icu": {
"version": "v1.6.0" "version": "v1.6.0"
}, },
"symfony/polyfill-intl-idn": { "symfony/polyfill-intl-normalizer": {
"version": "v1.11.0" "version": "v1.17.0"
}, },
"symfony/polyfill-mbstring": { "symfony/polyfill-mbstring": {
"version": "v1.6.0" "version": "v1.6.0"
}, },
"symfony/polyfill-php72": {
"version": "v1.8.0"
},
"symfony/polyfill-php73": { "symfony/polyfill-php73": {
"version": "v1.11.0" "version": "v1.11.0"
}, },
"symfony/polyfill-php80": {
"version": "v1.17.0"
},
"symfony/profiler-pack": { "symfony/profiler-pack": {
"version": "v1.0.3" "version": "v1.0.3"
}, },
"symfony/property-access": { "symfony/property-access": {
"version": "v4.0.0" "version": "v4.0.0"
}, },
"symfony/property-info": {
"version": "v5.1.0"
},
"symfony/routing": { "symfony/routing": {
"version": "3.3", "version": "3.3",
"recipe": { "recipe": {
@ -266,6 +278,9 @@
"symfony/stopwatch": { "symfony/stopwatch": {
"version": "v4.1.1" "version": "v4.1.1"
}, },
"symfony/string": {
"version": "v5.1.0"
},
"symfony/translation": { "symfony/translation": {
"version": "3.3", "version": "3.3",
"recipe": { "recipe": {
@ -294,6 +309,9 @@
"ref": "f75ac166398e107796ca94cc57fa1edaa06ec47f" "ref": "f75ac166398e107796ca94cc57fa1edaa06ec47f"
} }
}, },
"symfony/twig-pack": {
"version": "v1.0.0"
},
"symfony/validator": { "symfony/validator": {
"version": "4.3", "version": "4.3",
"recipe": { "recipe": {
@ -323,11 +341,17 @@
} }
}, },
"symfony/yaml": { "symfony/yaml": {
"version": "v3.3.13" "version": "v5.0.7"
},
"twig/extra-bundle": {
"version": "v3.0.3"
}, },
"twig/twig": { "twig/twig": {
"version": "v2.4.4" "version": "v2.4.4"
}, },
"webimpress/safe-writer": {
"version": "2.0.0"
},
"zendframework/zend-code": { "zendframework/zend-code": {
"version": "3.3.0" "version": "3.3.0"
}, },

View File

@ -16,6 +16,24 @@
{% include 'header.html.twig' %} {% include 'header.html.twig' %}
{% block body %}{% endblock %} {% block body %}{% endblock %}
</main> </main>
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://static.timshomepage.net/piwik/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '7']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="https://static.timshomepage.net/piwik/matomo.php?idsite=7&amp;rec=1" style="border:0;" alt="" /></p></noscript>
<!-- End Matomo Code -->
<script src="/js/vendor/jquery.js"></script> <script src="/js/vendor/jquery.js"></script>
<script src="/js/vendor/what-input.js"></script> <script src="/js/vendor/what-input.js"></script>
<script src="/js/vendor/foundation.min.js"></script> <script src="/js/vendor/foundation.min.js"></script>

View File

@ -10,7 +10,7 @@
<a href="{{ path('flash_index') }}">📸 Flashes</a> <a href="{{ path('flash_index') }}">📸 Flashes</a>
</li> </li>
<li class="{{ route starts with 'lens_' ? 'is-active' }}"> <li class="{{ route starts with 'lens_' ? 'is-active' }}">
<a href="{{ path('lens_index') }}">Lenses</a> <a href="{{ path('lens_index') }}">🔎 Lenses</a>
</li> </li>
</ul> </ul>
<ul class="menu"> <ul class="menu">
@ -22,7 +22,7 @@
<a href="{{ path('previously-owned-flash_index') }}">📸 Flashes</a> <a href="{{ path('previously-owned-flash_index') }}">📸 Flashes</a>
</li> </li>
<li class="{{ route starts with 'previously-owned-lens' ? 'is-active' }}"> <li class="{{ route starts with 'previously-owned-lens' ? 'is-active' }}">
<a href="{{ path('previously-owned-lens_index') }}">Lenses</a> <a href="{{ path('previously-owned-lens_index') }}">🔎 Lenses</a>
</li> </li>
</ul> </ul>
<ul class="menu"> <ul class="menu">
@ -31,7 +31,7 @@
<a href="{{ path('film_index') }}">🎞️ Film</a> <a href="{{ path('film_index') }}">🎞️ Film</a>
</li> </li>
<li class="{{ route starts with 'camera-type_' ? 'is-active' }}"> <li class="{{ route starts with 'camera-type_' ? 'is-active' }}">
<a href="{{ path('camera-type_index') }}">Camera Types</a> <a href="{{ path('camera-type_index') }}">🎥 Camera Types</a>
</li> </li>
</ul> </ul>
</div> </div>