Skip to content

Document to NEVER use getRouteCollection() / how to check if route exists #6710

@wouterj

Description

@wouterj

It isn't clear for people to not use Router#getRouteCollection(). Using this method will regenerate the Routing cache on each request, making apps very slow. I think we should explicitely tell people to not use this method.

A common use case of this method seems to be checking whether a route exists (symfony/symfony#19270, http://stackoverflow.com/q/14136484/1149495, http://stackoverflow.com/q/17241235/1149495, etc.). Maybe we can document to catch the RouteNotFoundException in such cases and then explain to not use getRouteCollection().

Metadata

Metadata

Assignees

No one assigned

    Labels

    RoutingactionableClear and specific issues ready for anyone to take them.good first issueIdeal for your first contribution! (some Symfony experience may be required)hasPRA Pull Request has already been submitted for this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions