-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Add Slug
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
588b94a
to
bd741b8
Compare
4bb94c8
to
0193d0c
Compare
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.
Can you add a test with a custom regex?
5029028
to
ef1188d
Compare
Done |
ef1188d
to
6233382
Compare
Thank you @raffaelecarelle. |
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 | MIT Commits ------- 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 | Fix symfony/symfony#58542 (comment) | License | MIT Commits ------- d51f563ed3c let the SlugValidator accept AsciiSlugger results
Introduce Slug constraint class for validating strings as slugs.
Add unit tests to verify correct behavior for valid and invalid slugs.