-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly respect router.request_context settings (#444)
* Properly respect router.request_context settings * Fixed failing tests
- Loading branch information
1 parent
c9a653f
commit c400d5f
Showing
11 changed files
with
438 additions
and
494 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,27 @@ | ||
controllers: | ||
resource: ../../src/Controller/ | ||
type: annotation | ||
index: | ||
path: / | ||
controller: FixtureProject\Controller\StaticRoutesController::index | ||
|
||
index_html: | ||
path: /index.html | ||
controller: FixtureProject\Controller\StaticRoutesController::indexHtml | ||
|
||
version_1_x: | ||
path: /version/1.x | ||
controller: FixtureProject\Controller\StaticRoutesController::versionHtml | ||
|
||
api: | ||
path: /api.json | ||
controller: FixtureProject\Controller\StaticRoutesController::apiJson | ||
|
||
api_xml: | ||
path: /api.xml | ||
controller: FixtureProject\Controller\StaticRoutesController::apiXml | ||
|
||
named_route: | ||
path: /named/route | ||
controller: FixtureProject\Controller\StaticRoutesController::namedRoute | ||
|
||
parametrized_route: | ||
path: /parametrized/{param1}/{param2} | ||
controller: FixtureProject\Controller\StaticRoutesController::withParameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,18 @@ | ||
<?php declare(strict_types=1); | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace FixtureProject; | ||
|
||
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\Loader\Configurator\RoutingConfigurator; | ||
|
||
class Kernel extends BaseKernel | ||
{ | ||
use MicroKernelTrait; | ||
|
||
private const CONFIG_EXTS = '.{php,xml,yaml,yml}'; | ||
|
||
public function registerBundles() : iterable | ||
{ | ||
$contents = require $this->getProjectDir() . '/config/bundles.php'; | ||
|
||
foreach ($contents as $class => $envs) { | ||
if ($envs[$this->environment] ?? $envs['all'] ?? false) { | ||
yield new $class(); | ||
} | ||
} | ||
} | ||
|
||
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', \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 . '/{services}' . self::CONFIG_EXTS, 'glob'); | ||
$loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob'); | ||
} | ||
|
||
protected function configureRoutes(RoutingConfigurator $routes) : void | ||
{ | ||
$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}' . self::CONFIG_EXTS, 'glob'); | ||
return \realpath(__DIR__ . '/../'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.