Skip to content

Cache is not invalidated for routes with container parameters #21426

@mhujer

Description

@mhujer
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.2.2

While using a @Route annotation in the controller, the dev cache is properly invalidated, if the route requirements are written directly in the annotation. But when using container parameters in requirements, the cache is not invalidated automatically and you need to delete cache/dev directory manually.

See the example: If another option is added to config, the route is not matched until the cache directory is manually deleted:

# config.yml
parameters:
    routing.type_slug: article|category
// DefaultController.php
/**
 * @Route("/{typeSlug}/", name="homepage", requirements={"typeSlug": "%routing.type_slug%"})
 */
public function indexAction(string $typeSlug, Request $request)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions