-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Unique entity custom message #15201
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
Unique entity custom message #15201
Conversation
Thanks 👍 |
Is the twig style standard or the translations style standard? |
According to other uses of variables in constraints messages (eg. EmailValidator), the standard is twig-style. |
All violations messages are passed to For example see: |
no new tests needed for that new behavior ? |
great work! 👍 |
@keradus I don't think so because i don't change the validation behaviour. |
OK, but how do we know that new behaviour works after some time? Tests can prove that when sb refactor sth this behaviour will still be working ;) |
Good 👍 |
@keradus you're right, i gonna add some tests |
thank you @Razmo ,give me a ping an i'll review it |
You're welcome @OskarStark ! |
if you use EDIT: Sorry @Razmo , didn't see, that you already added the test. |
@OskarStark test updated |
hmm, I don't know why the travis build is broken with 5.6, can you have a look @Razmo |
@OskarStark I run phpunit test in local and i have 5 failure on I don't think that it is caused by my changes EDIT: weird, it's ok now but i didn't make any changes |
$vars = array(); | ||
|
||
if (preg_match_all('/{{ ([a-zA-Z0-9_]+) }}/i', $constraint->message, $vars) > 0) { | ||
$accessor = PropertyAccess::createPropertyAccessor(); |
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.
You need to make sure that the PropertyAccess component is actually available and you should add it to the suggest
section in composer.json
.
Wouldn't it be better to be able to configure a list of object property names whose values would be passed to the actual constraint through the |
ping @stof |
@Razmo the merge to the 2.7 branch is done automatically afterwards |
@OskarStark Ok thx |
@OskarStark Phpunit tests passed in my local but didn't pass on travis. Have you any idea why ? |
no sorry @Razmo |
Failures seem to be related to the fact that your changes are based off the |
Wired because because my branch |
@Razmo Sure, but Symfony 2.6 itself doesn't receive bug fixes anymore. Probably, you can better reopen the PR based on the |
Close this PR and reopen it based on 2.8 branch |
Add the possibility to have custom message for unique entity constraint.
For example if we have a collection of entities in a form, the message can be more expressive.
Example:
I accidentally closed the previous opened PR (#13787), that why a recreate a pull request.