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
6 changes: 1 addition & 5 deletions Resources/config/routing/routing-sf4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">

<route id="fos_js_routing_js" path="/js/routing.{_format}" methods="GET">
<default key="_controller">fos_js_routing.controller::indexAction</default>
<default key="_format">js</default>
<requirement key="_format">js|json</requirement>
</route>
<import resource="routing.php" type="php" />
</routes>
32 changes: 32 additions & 0 deletions Resources/config/routing/routing.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/*
* 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.
*/

use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
use Symfony\Component\Routing\Loader\XmlFileLoader;

return function (RoutingConfigurator $routes): void {
foreach (debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT) as $trace) {
if (isset($trace['object']) && $trace['object'] instanceof XmlFileLoader && 'doImport' === $trace['function']) {
if (__DIR__ === dirname(realpath($trace['args'][3]))) {
trigger_deprecation('friendsofsymfony/jsrouting-bundle', '3.6', 'The "routing-sf4.xml" routing configuration file is deprecated, import "routing.php" instead.');

break;
}
}
}

$routes->add('fos_js_routing_js', '/js/routing.{_format}')
->methods(['GET'])
->controller('fos_js_routing.controller::indexAction')
->requirements(['_format' => 'js|json'])
->defaults(['_format' => 'js'])
;
};
2 changes: 1 addition & 1 deletion Resources/doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Load the bundle's routing definition in the application:
.. code-block:: yaml
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing-sf4.xml"
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.php"
Step 4: Publish the Assets
--------------------------
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
],
"require": {
"php": "^8.0",
"symfony/console": "^5.4|^6.0|^7.0",
"symfony/deprecation-contracts": "^2.1|^3.0",
"symfony/framework-bundle": "^5.4|^6.0|^7.0",
"symfony/serializer": "^5.4|^6.0.1|^7.0",
"symfony/console": "^5.4|^6.0|^7.0",
"willdurand/jsonp-callback-validator": "~1.1|^2.0"
},
"require-dev": {
Expand Down
Loading