Skip to content

Commit 38fa83f

Browse files
xabbuhnicolas-grekas
authored andcommitted
don't call EntityManager::initializeObject() with scalar values
Calling initializeObject() with a scalar value (e.g. the id of the associated entity) was a no-op call with Doctrine ORM 2 where no type was set with the method signature. The UnitOfWork which was called with the given argument ignored anything that was not an InternalProxy or a PersistentCollection instance. Calls like these now break with Doctrine ORM 3 as the method's argument is typed as object now.
1 parent 0d7717b commit 38fa83f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function validate($entity, Constraint $constraint)
104104

105105
$criteria[$fieldName] = $fieldValue;
106106

107-
if (null !== $criteria[$fieldName] && $class->hasAssociation($fieldName)) {
107+
if (\is_object($criteria[$fieldName]) && $class->hasAssociation($fieldName)) {
108108
/* Ensure the Proxy is initialized before using reflection to
109109
* read its identifiers. This is necessary because the wrapped
110110
* getter methods in the Proxy are being bypassed.

0 commit comments

Comments
 (0)