[CORE][Symfony] Fixed deprecation resultant from Symfony 5.1 upgrade

User Deprecated: Since symfony/framework-bundle 5.1: Using type
"Symfony\Component\Routing\RouteCollectionBuilder" for argument 1 of
method "App\Kernel:configureRoutes()" is deprecated, use
"Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator"
instead.
This commit is contained in:
Hugo Sales
2020-06-23 12:43:19 +00:00
committed by Hugo Sales
parent 7a52c1d823
commit bc6ead4ab1
2 changed files with 18 additions and 19 deletions

View File

@@ -31,14 +31,13 @@
namespace App;
use App\DependencyInjection\Compiler\SchemaDefPass;
use const PHP_VERSION_ID;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel
{
@@ -103,13 +102,17 @@ class Kernel extends BaseKernel
$loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
}
protected function configureRoutes(RouteCollectionBuilder $routes): void
protected function configureRoutes(RoutingConfigurator $routes): void
{
$confDir = $this->getProjectDir() . '/config';
$config = \dirname(__DIR__) . '/config';
$routes->import($config . '/{routes}/' . $this->environment . '/*.yaml');
$routes->import($config . '/{routes}/*.yaml');
$routes->import($confDir . '/{routes}/' . $this->environment . '/*' . self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob');
if (is_file($config . '/routes.yaml')) {
$routes->import($config . '/{routes}.yaml');
} elseif (is_file($path = $config . '/routes.php')) {
(require $path)($routes->withPath($path), $this);
}
}
protected function build(ContainerBuilder $container): void