Skip to content

Properly format value in UniqueEntityValidator #20287

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

Merged

Conversation

alcaeus
Copy link
Contributor

@alcaeus alcaeus commented Oct 24, 2016

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.

* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong license header :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops ;)

@alcaeus alcaeus force-pushed the unique-entity-format-invalid-value branch from 3d1fc75 to 9f9720e Compare November 4, 2016 16:01
* @return EntityManager
*/
public static function createTestEntityManager()
public static function createTestEntityManager(\Doctrine\ORM\Configuration $config = null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a use statement instead of using the FQCN (same in the docblock then)

{
if (!extension_loaded('pdo_sqlite')) {
\PHPUnit_Framework_TestCase::markTestSkipped('Extension pdo_sqlite is required.');
}

if ($config === null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null === $config

@alcaeus alcaeus force-pushed the unique-entity-format-invalid-value branch from 9f9720e to ed0d3fe Compare November 5, 2016 13:55
@alcaeus
Copy link
Contributor Author

alcaeus commented Nov 5, 2016

@xabbuh done!

/**
* The list of EntityRepository instances.
*
* @var \Doctrine\Common\Persistence\ObjectRepository[]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned by @xabbuh, you should use a use statement instead of using the FQCN (there are other occurrences in your patch).

/**
* Create a new repository instance for an entity class.
*
* @param \Doctrine\ORM\EntityManagerInterface $entityManager The EntityManager instance.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the phpdoc does not add any value, it should be removed, which is the case here and the same goes for the next one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand correctly. Do you mean the method description, parameter description or both?

@alcaeus alcaeus force-pushed the unique-entity-format-invalid-value branch from ed0d3fe to 9043a55 Compare November 6, 2016 09:18
@fabpot
Copy link
Member

fabpot commented Nov 6, 2016

Thank you @alcaeus.

@fabpot fabpot merged commit 9043a55 into symfony:3.1 Nov 6, 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
@alcaeus alcaeus deleted the unique-entity-format-invalid-value branch November 7, 2016 06:51
This was referenced Nov 17, 2016
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.

4 participants