Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Validator] AddSlug
constraint#58542
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
588b94a
tobd741b8
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
4bb94c8
to0193d0c
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you add a test with a custom regex?
5029028
toef1188d
Compare
Done |
Thank you@raffaelecarelle. |
18d08ff
intosymfony:7.3Uh oh!
There was an error while loading.Please reload this page.
Kocal commentedApr 29, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hey, are we fine with |
{ | ||
public const NOT_SLUG_ERROR = '14e6df1e-c8ab-4395-b6ce-04b132a3765e'; | ||
public string $message = 'This value is not a valid slug.'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This message needs to be added in translation files (so that the translators from the community can provide translations for it in core, like other default messages of constraints)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this has already been done in#59383
…results (xabbuh)This PR was merged into the 7.3 branch.Discussion----------[Validator] let the `SlugValidator` accept `AsciiSlugger` results| Q | A| ------------- | ---| Branch? | 7.3| Bug fix? | no| New feature? | no| Deprecations? | no| Issues |Fix#58542 (comment)| License | MITCommits-------d51f563 let the SlugValidator accept AsciiSlugger results
…results (xabbuh)This PR was merged into the 7.3 branch.Discussion----------[Validator] let the `SlugValidator` accept `AsciiSlugger` results| Q | A| ------------- | ---| Branch? | 7.3| Bug fix? | no| New feature? | no| Deprecations? | no| Issues |Fixsymfony/symfony#58542 (comment)| License | MITCommits-------d51f563ed3c let the SlugValidator accept AsciiSlugger results
This commit revertssymfony#58542.
This PR was merged into the 7.3 branch.Discussion----------[Validator] Revert Slug constraint| Q | A| ------------- | ---| Branch? | 7.3| Bug fix? | no| New feature? | no| Deprecations? | no| Issues | Reverts#58542| License | MITAfter an internal discussion, I think it's best to revert the introduction of the `Slug` constraint:* There is no official standard for slugs, or what a slug means exactly. Within Symfony, it would be best to comply with what our `AsciiSlugger` is doing, but a [more common approach](https://en.wikipedia.org/wiki/Clean_URL#Slug) is to only allow lowercase characters.* The constraint adds little on top of the existing `Regex` constraint, especially when using it's `regex` option to customize the pattern for slugs.Considering this, I believe it is always better for applications to be clear on what they allow in a slug using the `Regex` constraint.Commits-------5789965 Revert Slug constraint
Uh oh!
There was an error while loading.Please reload this page.
Introduce Slug constraint class for validating strings as slugs.
Add unit tests to verify correct behavior for valid and invalid slugs.