From 63580dfe262c22a0cc4964770df1e457b3695d50 Mon Sep 17 00:00:00 2001 From: "Fabio B. Silva" Date: Wed, 27 Jun 2012 00:24:53 -0300 Subject: [PATCH] Fix CS --- .../ORM/Persisters/BasicEntityPersister.php | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php index eeeb89dd8..8b54271c9 100644 --- a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php @@ -1140,28 +1140,27 @@ class BasicEntityPersister */ protected function _getSelectManyToManyJoinSQL(array $manyToMany) { + $conditions = array(); + $association = $manyToMany; + $sourceTableAlias = $this->_getSQLTableAlias($this->_class->name); - $conditions = array(); - $sourceTableAlias = $this->_getSQLTableAlias($this->_class->name); + if ( ! $manyToMany['isOwningSide']) { + $targetEntity = $this->_em->getClassMetadata($manyToMany['targetEntity']); + $association = $targetEntity->associationMappings[$manyToMany['mappedBy']]; + } - $association = ($manyToMany['isOwningSide']) - ? $manyToMany - : $this->_em->getClassMetadata($manyToMany['targetEntity']) - ->associationMappings[$manyToMany['mappedBy']]; - - $relationColumns = ($manyToMany['isOwningSide']) + $joinTableName = $this->quoteStrategy->getJoinTableName($association, $this->_class, $this->_platform); + $joinColumns = ($manyToMany['isOwningSide']) ? $association['joinTable']['inverseJoinColumns'] : $association['joinTable']['joinColumns']; - $joinTableName = $this->quoteStrategy->getJoinTableName($association, $this->_class, $this->_platform); - foreach ($relationColumns as $joinColumn) { + foreach ($joinColumns as $joinColumn) { $quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->_class, $this->_platform); $quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $this->_class, $this->_platform); - - $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableName . '.' . $quotedSourceColumn; + $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableName . '.' . $quotedSourceColumn; } - return ' INNER JOIN ' . $joinTableName . ' ON ' . implode(' AND ', $conditions); + return ' INNER JOIN ' . $joinTableName . ' ON ' . implode(' AND ', $conditions); } /**