1
0
mirror of https://framagit.org/tykayn/date-poll-api synced 2023-08-25 08:23:11 +02:00
date-poll-api/src/Kernel.php

37 lines
1.4 KiB
PHP
Raw Normal View History

2019-10-24 13:06:51 +02:00
<?php
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
2019-10-24 13:06:51 +02:00
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
2021-04-27 10:22:16 +02:00
use function dirname;
2019-10-24 13:06:51 +02:00
2021-04-27 10:22:16 +02:00
class Kernel extends BaseKernel {
use MicroKernelTrait;
2019-10-24 13:06:51 +02:00
2021-04-27 10:22:16 +02:00
protected function configureContainer( ContainerConfigurator $container ): void {
$container->import( '../config/{packages}/*.yaml' );
$container->import( '../config/{packages}/' . $this->environment . '/*.yaml' );
2021-04-27 10:22:16 +02:00
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 );
}
}
2019-10-24 13:06:51 +02:00
2021-04-27 10:22:16 +02:00
protected function configureRoutes( RoutingConfigurator $routes ): void {
$routes->import( '../config/{routes}/' . $this->environment . '/*.yaml' );
$routes->import( '../config/{routes}/*.yaml' );
2019-10-24 13:06:51 +02:00
2021-04-27 10:22:16 +02:00
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 );
}
}
2019-10-24 13:06:51 +02:00
}