Skip to content

Added {{ value }} message placeholder to UniqueEntityValidator #15279

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
wants to merge 1 commit into from
Closed

Added {{ value }} message placeholder to UniqueEntityValidator #15279

wants to merge 1 commit into from

Conversation

jperovic
Copy link
Contributor

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.

@jperovic
Copy link
Contributor Author

Just wanted to ask quick question here, to which I didn't find any answer in CONTRIBUTING document.

When I run "phpunit" command, it works until it gets stuck with QuestionHelperTest::testAskChoice test. I did a little bit of research and it seems that it gets stuck due to interactive argument being set to true in InputStream instance. After that, code hits this infinite while loop ($attempts is NULL):

# Symfony\Component\Console\Helper\QuestionHelper::validateAttempts()
while (null === $attempts || $attempts--) {
            if (null !== $error) {
                $this->writeError($output, $error);
            }

            try {
                return call_user_func($question->getValidator(), $interviewer());
            } catch (\Exception $error) {
            }
        }

Is this known limitation? I have Centos 6.5 and PHP 5.6...

@jakzal
Copy link
Contributor

jakzal commented Jul 15, 2015

@jperovic that's a bug. I'm looking into this.

@jperovic
Copy link
Contributor Author

@jakzal Cool, thanks :)

@Minishlink
Copy link

Hello, thanks for this ! 👍

Just a quick note: UniqueEntityValidator can have several fields. As such, one should be able to refer to all these fields in the validation message eg. "The combination of {{ field1 }} and {{ field2 }} should be unique.".

Also, see #15201. You both address the same issue.

@fabpot
Copy link
Member

fabpot commented Oct 19, 2015

@jakzal Are you still looking at this bug?

@jakzal
Copy link
Contributor

jakzal commented Oct 21, 2015

@fabpot I fixed it in #15280. Looks like I forgot to update this ticket (which is actually not related to the issue with tests).

@fabpot
Copy link
Member

fabpot commented Jan 25, 2016

Thank you @jperovic.

@fabpot fabpot closed this in cda6cba Jan 25, 2016
@jperovic jperovic deleted the ticket_15268 branch January 28, 2016 07:05
@fabpot fabpot mentioned this pull request May 13, 2016
fabpot added a commit that referenced this pull request Nov 6, 2016
This PR was merged into the 3.1 branch.

Discussion
----------

Properly format value in UniqueEntityValidator

| Q | A |
| --- | --- |
| Branch? | 3.1 |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | / |
| License | MIT |

This PR fixes a small issue introduced in #15279. Having an array in a field considered for a unique check causes an array to string conversion error in the translator. This can be avoided by formatting the value parameter with `formatValue`.

Commits
-------

9043a55 Properly format value in UniqueEntityValidator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants