Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/code_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on: ["push", "pull_request"]
jobs:
js-tests:
name: "JS Tests"
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -20,7 +20,7 @@ jobs:
cd Resources && npm run test
phpunit:
name: "PHP ${{ matrix.php }} + ${{ matrix.dependencies }} dependencies + Symfony ${{ matrix.symfony }}"
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand Down
9 changes: 5 additions & 4 deletions DependencyInjection/FOSJsRoutingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

/**
Expand All @@ -31,14 +32,14 @@ public function load(array $configs, ContainerBuilder $container): void
$configuration = new Configuration();
$config = $processor->processConfiguration($configuration, $configs);

$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
$loader->load('controllers.xml');
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.php');
$loader->load('controllers.php');

if (isset($config['serializer'])) {
$container->setAlias('fos_js_routing.serializer', new Alias($config['serializer'], false));
} else {
$loader->load('serializer.xml');
$loader->load('serializer.php');
}

$container->setAlias(
Expand Down
32 changes: 32 additions & 0 deletions Resources/config/controllers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

/*
* This file is part of the FOSJsRoutingBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use FOS\JsRoutingBundle\Controller\Controller;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->parameters()
->set('fos_js_routing.controller.class', Controller::class);

$containerConfigurator->services()
->set('fos_js_routing.controller', '%fos_js_routing.controller.class%')
->public()
->args([
service('fos_js_routing.routes_response'),
service('fos_js_routing.serializer'),
service('fos_js_routing.extractor'),
param('fos_js_routing.cache_control'),
param('kernel.debug'),
]);
};
17 changes: 0 additions & 17 deletions Resources/config/controllers.xml

This file was deleted.

49 changes: 49 additions & 0 deletions Resources/config/serializer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

declare(strict_types=1);

/*
* This file is part of the FOSJsRoutingBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use FOS\JsRoutingBundle\Serializer\Denormalizer\RouteCollectionDenormalizer;
use FOS\JsRoutingBundle\Serializer\Normalizer\RouteCollectionNormalizer;
use FOS\JsRoutingBundle\Serializer\Normalizer\RoutesResponseNormalizer;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Serializer;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->parameters()
->set('fos_js_routing.normalizer.route_collection.class', RouteCollectionNormalizer::class)
->set('fos_js_routing.normalizer.routes_response.class', RoutesResponseNormalizer::class)
->set('fos_js_routing.denormalizer.route_collection.class', RouteCollectionDenormalizer::class);

$containerConfigurator->services()
->set('fos_js_routing.serializer', Serializer::class)
->public()
->args([
[
service('fos_js_routing.normalizer.route_collection'),
service('fos_js_routing.normalizer.routes_response'),
service('fos_js_routing.denormalizer.route_collection'),
],
[
'json' => service('fos_js_routing.encoder'),
],
])

->set('fos_js_routing.normalizer.route_collection', '%fos_js_routing.normalizer.route_collection.class%')

->set('fos_js_routing.normalizer.routes_response', '%fos_js_routing.normalizer.routes_response.class%')

->set('fos_js_routing.denormalizer.route_collection', '%fos_js_routing.denormalizer.route_collection.class%')

->set('fos_js_routing.encoder', JsonEncoder::class);
};
32 changes: 0 additions & 32 deletions Resources/config/serializer.xml

This file was deleted.

55 changes: 55 additions & 0 deletions Resources/config/services.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

declare(strict_types=1);

/*
* This file is part of the FOSJsRoutingBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use FOS\JsRoutingBundle\Command\DumpCommand;
use FOS\JsRoutingBundle\Command\RouterDebugExposedCommand;
use FOS\JsRoutingBundle\Extractor\ExposedRoutesExtractor;
use FOS\JsRoutingBundle\Response\RoutesResponse;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->parameters()
->set('fos_js_routing.extractor.class', ExposedRoutesExtractor::class)
->set('fos_js_routing.routes_response.class', RoutesResponse::class);

$containerConfigurator->services()
->set('fos_js_routing.extractor', '%fos_js_routing.extractor.class%')
->public()
->args([
service('fos_js_routing.router'),
abstract_arg('routes to expose'),
param('kernel.cache_dir'),
param('kernel.bundles'),
])

->set('fos_js_routing.routes_response', '%fos_js_routing.routes_response.class%')
->public()

->set('fos_js_routing.dump_command', DumpCommand::class)
->tag('console.command')
->args([
service('fos_js_routing.routes_response'),
service('fos_js_routing.extractor'),
service('fos_js_routing.serializer'),
param('kernel.project_dir'),
param('fos_js_routing.request_context_base_url'),
])

->set('fos_js_routing.router_debug_exposed_command', RouterDebugExposedCommand::class)
->tag('console.command')
->args([
service('fos_js_routing.extractor'),
service('router'),
]);
};
33 changes: 0 additions & 33 deletions Resources/config/services.xml

This file was deleted.

Loading