1
0
Fork 0
mirror of synced 2025-04-03 05:13:37 +03:00

Fixed owing-inverse side search by criteria

This commit is contained in:
Asmir Mustafic 2015-01-30 00:24:09 +01:00 committed by Marco Pivetta
parent 4d531d8855
commit 1630ec1ebd

View file

@ -1650,14 +1650,18 @@ class BasicEntityPersister implements EntityPersister
$association = $this->class->associationMappings[$field]; $association = $this->class->associationMappings[$field];
// Many-To-Many requires join table check for joinColumn // Many-To-Many requires join table check for joinColumn
$columns = array(); $columns = array();
$class = $this->class;
if ($association['type'] === ClassMetadata::MANY_TO_MANY) { if ($association['type'] === ClassMetadata::MANY_TO_MANY) {
if ( ! $association['isOwningSide']) { if ( ! $association['isOwningSide']) {
$association = $assoc; $association = $assoc;
} }
$joinColumns = $assoc['isOwningSide']
? $association['joinTable']['joinColumns']
: $association['joinTable']['inverseJoinColumns'];
$joinTableName = $this->quoteStrategy->getJoinTableName($association, $this->class, $this->platform); $joinTableName = $this->quoteStrategy->getJoinTableName($association, $class, $this->platform);
foreach ($association['joinTable']['joinColumns'] as $joinColumn) { foreach ($joinColumns as $joinColumn) {
$columns[] = $joinTableName . '.' . $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); $columns[] = $joinTableName . '.' . $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform);
} }
} else { } else {