From f88f5ce4549a8468cea2c3364e96fee2be42d1ea Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sat, 17 Jan 2015 06:21:16 +0100 Subject: [PATCH] #1178 - fetching actual target entity when resolving column types of it --- .../ORM/Persisters/Collection/ManyToManyPersister.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php b/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php index 86e7b0923..bccf33dcc 100644 --- a/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php @@ -602,10 +602,11 @@ class ManyToManyPersister extends AbstractCollectionPersister foreach ($mapping['joinTableColumns'] as $joinTableColumn) { if (isset($mapping[$relationMode][$joinTableColumn])) { - $whereClauses[] = 't.' . $joinTableColumn . ' = ?'; - $column = $mapping[$relationMode][$joinTableColumn]; - $params[] = $id[$targetEntity->getFieldForColumn($column)]; - $types[] = PersisterHelper::getTypeOfColumn($column, $targetEntity, $this->em); + $whereClauses[] = 't.' . $joinTableColumn . ' = ?'; + $column = $mapping[$relationMode][$joinTableColumn]; + $columnOwningClass = $this->em->getClassMetadata($mapping['targetEntity']); + $params[] = $id[$columnOwningClass->getFieldForColumn($column)]; + $types[] = PersisterHelper::getTypeOfColumn($column, $columnOwningClass, $this->em); } elseif ( ! $joinNeeded) { $whereClauses[] = 't.' . $joinTableColumn . ' = ?'; $params[] = $key;