Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DoctrineBridge] don't callEntityManager::initializeObject() with scalar values#58908

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:5.4fromxabbuh:issue-58906
Nov 20, 2024

Conversation

xabbuh
Copy link
Member

QA
Branch?5.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#58906
LicenseMIT

CallinginitializeObject() 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. TheUnitOfWork which was called with the given argument ignored anything that was not anInternalProxy or aPersistentCollection instance.

Calls like these now break with Doctrine ORM 3 as the method's argument is typed as object now.

@carsonbotcarsonbot added this to the5.4 milestoneNov 18, 2024
@OskarStarkOskarStark changed the title[DoctrineBridge] don't call EntityManager::initializeObject() with scalar values[DoctrineBridge] don't callEntityManager::initializeObject() with scalar valuesNov 18, 2024
@@ -104,7 +104,7 @@ public function validate($entity, Constraint $constraint)

$criteria[$fieldName] = $fieldValue;

if (null !== $criteria[$fieldName] && $class->hasAssociation($fieldName)) {
if (null !== $criteria[$fieldName] &&is_object($criteria[$fieldName]) &&$class->hasAssociation($fieldName)) {

Choose a reason for hiding this comment

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

Suggested change
if (null !==$criteria[$fieldName] &&is_object($criteria[$fieldName]) &&$class->hasAssociation($fieldName)) {
if (\is_object($criteria[$fieldName]) &&$class->hasAssociation($fieldName)) {

Calling initializeObject() with a scalar value (e.g. the id of theassociated entity) was a no-op call with Doctrine ORM 2 where no typewas set with the method signature. The UnitOfWork which was calledwith the given argument ignored anything that was not an InternalProxyor a PersistentCollection instance.Calls like these now break with Doctrine ORM 3 as the method's argumentis typed as object now.
@nicolas-grekas
Copy link
Member

Thank you@xabbuh.

@nicolas-grekasnicolas-grekas merged commit1d3d562 intosymfony:5.4Nov 20, 2024
4 of 5 checks passed
@xabbuhxabbuh deleted the issue-58906 branchNovember 20, 2024 10:46
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@alexandre-dauboisalexandre-dauboisalexandre-daubois approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
5.4
Development

Successfully merging this pull request may close these issues.

4 participants
@xabbuh@nicolas-grekas@alexandre-daubois@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp