From 3539b32629b097d06aef9f96b51bad31cc8a4c2f Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 2 Jan 2011 15:14:12 +0100 Subject: [PATCH] DDC-546 - Found some more code that needs DDC-117 compliance. --- lib/Doctrine/ORM/Persisters/ManyToManyPersister.php | 6 +++++- lib/Doctrine/ORM/Persisters/OneToManyPersister.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php b/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php index bbea8c1f8..6ca2b15a5 100644 --- a/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php @@ -210,7 +210,11 @@ class ManyToManyPersister extends AbstractCollectionPersister } $whereClause .= "$joinTableColumn = ?"; - $params[] = $id[$class->fieldNames[$joinColumns[$joinTableColumn]]]; + if ($class->containsForeignIdentifier) { + $params[] = $id[$class->getFieldForColumn($joinColumns[$joinTableColumn])]; + } else { + $params[] = $id[$class->fieldNames[$joinColumns[$joinTableColumn]]]; + } } } $sql = 'SELECT count(*) FROM ' . $joinTable['name'] . ' WHERE ' . $whereClause; diff --git a/lib/Doctrine/ORM/Persisters/OneToManyPersister.php b/lib/Doctrine/ORM/Persisters/OneToManyPersister.php index 4e17cb973..5e889ddb9 100644 --- a/lib/Doctrine/ORM/Persisters/OneToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/OneToManyPersister.php @@ -134,7 +134,11 @@ class OneToManyPersister extends AbstractCollectionPersister $where .= ' AND '; } $where .= $joinColumn['name'] . " = ?"; - $params[] = $id[$class->fieldNames[$joinColumn['referencedColumnName']]]; + if ($class->containsForeignIdentifier) { + $params[] = $id[$class->getFieldForColumn($joinColumn['referencedColumnName'])]; + } else { + $params[] = $id[$class->fieldNames[$joinColumn['referencedColumnName']]]; + } } $sql = "SELECT count(*) FROM " . $class->getQuotedTableName($this->_conn->getDatabasePlatform()) . " WHERE " . $where;