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

Skip to content

Commit 1d3d562

Browse files
bug symfony#58908 [DoctrineBridge] don't call EntityManager::initializeObject() with scalar values (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [DoctrineBridge] don't call `EntityManager::initializeObject()` with scalar values | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix symfony#58906 | License | MIT 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. Commits ------- 38fa83f don't call EntityManager::initializeObject() with scalar values
2 parents 0f1e839 + 38fa83f commit 1d3d562

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)