Description
I followed How to Use Service Container Parameters in your Routes to configure the _locale
prefix for the Sonata Admin routes in my project and got the error message
The parameter "app.route_prefix" must be defined.
After a second look on the documentation and my local changes I found out that the section "You can also use a parameter to define your route path (or part of your path)" uses the %app.route_prefix%
parameter but never defines it. In the documentation the information should be added, where and how to define this parameter, especially that "_locale" must be added as placeholder {_locale}
and not as _locale
:
YAML:
# config/services.yaml
parameters:
app.route_prefix: '{_locale}'
XML:
<!-- config/services.xml -->
<?xml version="1.0" charset="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="app.route_prefix">{_locale}</parameter>
</parameters>
</container>
PHP:
// config/services.php
$container->setParameter('app.route_prefix', '{_locale}');
I'm not editing the documentation on my own because I don't know the exact syntax for RST and and the Symfony rules for the documentation and at the moment have no time to read into it :-(