Skip to content

[Routing] Add Requirement, a collection of universal regular-expression… #16718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fabpot opened this issue Apr 15, 2022 · 3 comments
Closed
Labels
actionable Clear and specific issues ready for anyone to take them. Routing
Milestone

Comments

@fabpot
Copy link
Member

fabpot commented Apr 15, 2022

Q A
Feature PR symfony/symfony#45528
PR author(s) @fancyweb
Merged in 6.1
@wouterj wouterj added this to the 6.1 milestone May 1, 2022
@wouterj
Copy link
Member

wouterj commented May 3, 2022

Hi @fancyweb :) Do you have time to add some docs about this wonderful helper class in https://symfony.com/doc/6.1/routing.html#parameters-validation ?

@wouterj wouterj added the actionable Clear and specific issues ready for anyone to take them. label May 3, 2022
javiereguiluz added a commit that referenced this issue Jul 4, 2022
…rst (nicwortel)

This PR was merged into the 6.1 branch.

Discussion
----------

[Routing] Document the Requirement constants in routing.rst

Fixes #16718

symfony/symfony#45528 by `@fancyweb` introduced the `Symfony\Component\Routing\Requirement\Requirement` enum in Symfony 6.1, as a solution for symfony/symfony#26524.

It was blogged about in https://symfony.com/blog/new-in-symfony-6-1-improved-routing-requirements-and-utf-8-parameters, but I couldn't find it anywhere in the Routing documentation.

This PR adds a small hint about the use of the `Requirement` enum for common route requirements:

![The Requirement enum contains a collection of commonly used regular-expression constants such as digits, dates and UUIDs which can be used as route parameter requirements.](https://user-images.githubusercontent.com/1055691/176497123-24b9bf6e-1b79-4385-baee-0eb132ae8944.png)

I'm open for suggestions to further improve this. I decided to use a small info block instead without code examples, because it doesn't seem to be a big feature and I'm not sure how well it is supported across all configuration formats. Let me know if you would like to see some code examples.

Commits
-------

571647d Document the Requirement constants in routing.rst
@nicwortel
Copy link
Contributor

With the merging of #16926, I think this issue can now be closed.

@javiereguiluz
Copy link
Member

Yes, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable Clear and specific issues ready for anyone to take them. Routing
Projects
None yet
Development

No branches or pull requests

5 participants