Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Doctrine] [Bridge] UniqueEntity validator should add "{{ value }}" message placeholder #15268

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
jperovic opened this issue Jul 14, 2015 · 3 comments
Labels

Comments

@jperovic
Copy link
Contributor

When validating uniqueness fails, UniqueEntityValidator does not add "{{ value }}" message placeholder, as other validators do.

This might be useful when printing what went wrong during the validation.

So, instead of:

# Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator 
$this->buildViolation($constraint->message)
                ->atPath($errorPath)
                ->setInvalidValue($invalidValue)
                ->addViolation();

we should probably have:

# Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator 
$this->buildViolation($constraint->message)
                ->atPath($errorPath)
                ->setParameter('{{ value }}', $invalidValue)
                ->setInvalidValue($invalidValue)
                ->addViolation();
@jakzal
Copy link
Contributor

jakzal commented Jul 14, 2015

@jperovic would you like to send a PR implementing this improvement?

@jperovic
Copy link
Contributor Author

Yes, I have code changes ready to post, with passed tests. I'll send it in next hour or so, if that's ok...

@OskarStark
Copy link
Contributor

thank you @jperovic

@fabpot fabpot added the Doctrine label Oct 5, 2015
fabpot added a commit that referenced this issue Jan 25, 2016
…alidator (jperovic)

This PR was submitted for the 2.8 branch but it was merged into the 3.1-dev branch instead (closes #15279).

Discussion
----------

Added {{ value }} message placeholder to UniqueEntityValidator

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #15268
| License       | MIT
| Doc PR        | -

Apologize if I missed something. This is my first contribution to a large scale project.

Commits
-------

9cf1ce9 Added {{ value }} message placeholder to UniqueEntityValidator
@fabpot fabpot closed this as completed Jan 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants