forked from doctrine/orm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
From 06c8d9ac6c12794b6464d8c1a768a94b5d80c4c8 Mon Sep 17 00:00:00 2001 | ||
From: Tom Udding <[email protected]> | ||
Date: Mon, 1 Jan 2024 14:23:00 +0100 | ||
Subject: [PATCH 1/1] Revert "Fix lazy loading of 1-to-1 relationship with | ||
custom id object" | ||
|
||
This reverts a small change to `Doctrine\ORM\Persisters\Entity\BasicEntityPersister` | ||
which caused one-to-one relations with an `JoinColumns` annotation to break. | ||
--- | ||
.../ORM/Persisters/Entity/BasicEntityPersister.php | 10 +++++++++- | ||
.../Tests/ORM/Functional/Ticket/GH5887Test.php | 2 ++ | ||
2 files changed, 11 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php | ||
index 0d11dc923..c54e9fc87 100644 | ||
--- a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php | ||
+++ b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php | ||
@@ -836,7 +836,15 @@ class BasicEntityPersister implements EntityPersister | ||
); | ||
} | ||
|
||
- $computedIdentifier[$targetClass->getFieldForColumn($targetKeyColumn)] = | ||
+ // Revert change made in v2.6, which causes one-to-one relations with an | ||
+ // @JoinColumns annotation to break. Is required for Decisions. | ||
+ // See https://github.com/doctrine/orm/issues/7579 for more information. | ||
+ // | ||
+ // Original: | ||
+ // $computedIdentifier[$targetClass->getFieldForColumn($targetKeyColumn)] = | ||
+ // | ||
+ // Patched: | ||
+ $computedIdentifier[$this->getSQLTableAlias($targetClass->name) . '.' . $targetKeyColumn] = | ||
$sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity); | ||
} | ||
|
||
diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5887Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5887Test.php | ||
index 1cc6169df..be836fbaa 100644 | ||
--- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5887Test.php | ||
+++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5887Test.php | ||
@@ -31,6 +31,8 @@ class GH5887Test extends OrmFunctionalTestCase | ||
|
||
public function testLazyLoadsForeignEntitiesInOneToOneRelationWhileHavingCustomIdObject(): void | ||
{ | ||
+ $this->markTestSkipped('This test is marked as skipped due to a custom patch made to Doctrine\ORM\Persisters\Entity\BasicEntityPersister. It fails to lazy-load an object with a custom id. Since there are no custom ids present, failure of this test case can be ignored.'); | ||
+ | ||
$customerId = new GH5887CustomIdObject(1); | ||
$customer = new GH5887Customer(); | ||
$customer->setId($customerId); | ||
-- | ||
2.42.0 | ||
|