From 013262a9b7b1b565733fc4353e2bbb673792f93e Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sat, 7 Aug 2010 21:09:19 +0200 Subject: [PATCH] Add support for EntityManager::remove() of full or partial association primary keys --- lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php | 6 +++++- tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index 4edca896b..edd7cd53f 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -687,7 +687,11 @@ class ClassMetadataInfo if ($this->isIdentifierComposite) { $columnNames = array(); foreach ($this->identifier as $idField) { - $columnNames[] = $this->fieldMappings[$idField]['columnName']; + if (isset($this->associationMappings[$idField])) { + $columnNames[] = $this->associationMappings[$idField]->joinColumns[0]['name']; + } else { + $columnNames[] = $this->fieldMappings[$idField]['columnName']; + } } return $columnNames; } else { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php index 5b358694a..6084812f1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php @@ -55,6 +55,9 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertType(__NAMESPACE__."\DDC117Article", $refRep->source()); $this->assertSame($refRep, $this->_em->find(__NAMESPACE__."\DDC117Reference", array('source' => 1, 'target' => 2))); + + $this->_em->remove($refRep); + $this->_em->flush(); } /**