1
0
mirror of synced 2024-12-14 07:06:04 +03:00

Add support for EntityManager::remove() of full or partial association primary keys

This commit is contained in:
Benjamin Eberlei 2010-08-07 21:09:19 +02:00
parent 10f47389ae
commit 013262a9b7
2 changed files with 8 additions and 1 deletions

View File

@ -687,7 +687,11 @@ class ClassMetadataInfo
if ($this->isIdentifierComposite) { if ($this->isIdentifierComposite) {
$columnNames = array(); $columnNames = array();
foreach ($this->identifier as $idField) { 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; return $columnNames;
} else { } else {

View File

@ -55,6 +55,9 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase
$this->assertType(__NAMESPACE__."\DDC117Article", $refRep->source()); $this->assertType(__NAMESPACE__."\DDC117Article", $refRep->source());
$this->assertSame($refRep, $this->_em->find(__NAMESPACE__."\DDC117Reference", array('source' => 1, 'target' => 2))); $this->assertSame($refRep, $this->_em->find(__NAMESPACE__."\DDC117Reference", array('source' => 1, 'target' => 2)));
$this->_em->remove($refRep);
$this->_em->flush();
} }
/** /**