Parent Epic: #311
Refs #496, #519.
Both issues came up while checking #519's non-Sylius case with a throwaway micro-kernel (FrameworkBundle, TwigBundle and DurablePlugin, no Sylius, on the root's Symfony 8 vendor). Neither is a Twig error, and neither was introduced by #519. In both cases the request never reaches the controller, so #519's 404 guard only covers a kernel that defines sylius_admin.path_name but has no Sylius admin layout.
1. The route path needs a Sylius parameter
Since #496, src/DurablePlugin/config/routes.yaml declares path: /%sylius_admin.path_name%/durable/dashboard. Only Sylius's AdminBundle defines that parameter (AdminBundle/Resources/config/app/config.yml:9). Without Sylius, requesting the route throws:
Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException:
You have requested a non-existent parameter "sylius_admin.path_name".
2. The routes are YAML, and the plugin does not require symfony/yaml
gplanchat/durable-plugin's composer.json requires symfony/routing but not symfony/yaml. An application without symfony/yaml that imports @DurablePlugin/config/routes.yaml fails on every request:
Error: Class "Symfony\Component\Yaml\Parser" not found
Every Sylius application has symfony/yaml, so today only a non-Sylius application hits this.
Options
- (2), with no manifest change: ship the route as
config/routes.php in the closure format (return static function (RoutingConfigurator $routes): void { … };).
Symfony\Component\Routing\Loader\PhpFileLoader is part of symfony/routing, which the plugin already requires. It only delegates to the YAML loader when the file returns an array, so the closure format needs no YAML.
- This is a BC change for shops, which import
@DurablePlugin/config/routes.yaml. The options are to keep a routes.yaml alongside for one release, or to document the new import in UPGRADE.md.
- (2), with a manifest change: add
symfony/yaml to the plugin's require. composer.json is a hard limit, so a human must decide.
- (1): either keep the Sylius parameter and state that the plugin's routes need the Sylius admin, or give the plugin a fallback when the parameter is absent (for example a prefix of its own, set in
prepend() only when the parameter is not defined). Take care with ordering: Sylius defines the parameter in its app config.
Done when
Parent Epic: #311
Refs #496, #519.
Both issues came up while checking #519's non-Sylius case with a throwaway micro-kernel (FrameworkBundle, TwigBundle and
DurablePlugin, no Sylius, on the root's Symfony 8 vendor). Neither is a Twig error, and neither was introduced by #519. In both cases the request never reaches the controller, so #519's 404 guard only covers a kernel that definessylius_admin.path_namebut has no Sylius admin layout.1. The route path needs a Sylius parameter
Since #496,
src/DurablePlugin/config/routes.yamldeclarespath: /%sylius_admin.path_name%/durable/dashboard. Only Sylius's AdminBundle defines that parameter (AdminBundle/Resources/config/app/config.yml:9). Without Sylius, requesting the route throws:2. The routes are YAML, and the plugin does not require
symfony/yamlgplanchat/durable-plugin'scomposer.jsonrequiressymfony/routingbut notsymfony/yaml. An application withoutsymfony/yamlthat imports@DurablePlugin/config/routes.yamlfails on every request:Every Sylius application has
symfony/yaml, so today only a non-Sylius application hits this.Options
config/routes.phpin the closure format (return static function (RoutingConfigurator $routes): void { … };).Symfony\Component\Routing\Loader\PhpFileLoaderis part ofsymfony/routing, which the plugin already requires. It only delegates to the YAML loader when the file returns an array, so the closure format needs no YAML.@DurablePlugin/config/routes.yaml. The options are to keep aroutes.yamlalongside for one release, or to document the new import inUPGRADE.md.symfony/yamlto the plugin'srequire.composer.jsonis a hard limit, so a human must decide.prepend()only when the parameter is not defined). Take care with ordering: Sylius defines the parameter in its app config.Done when
symfony/yaml) that imports the plugin's routes boots, and the dashboard route answers the feat(plugin): the Sylius admin hooks compose the dashboard; a previous-page link (#383 slice A, #256) #519 404 instead of an exception. A kernel test proves it.