Skip to content

[Task] The plugin's routes need Sylius's path parameter and symfony/yaml, which it does not require #520

Description

@gplanchat

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    loop:trustedAuthor is on the team; the agentic loop may read this issuetaskConcrete work unit (WA003)

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions