Changeset 5095

Show
Ignore:
Timestamp:
10/15/08 21:45:14 (9 months ago)
Author:
jwage
Message:

[1.0, 1.1] fixes #1341 - issue with local/foreign and column aliases

Location:
branches
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Query.php

    r5066 r5095  
    15801580                                . $localTable->getColumnName($localTable->getIdentifier())) // what about composite keys? 
    15811581                                . ' = ' 
    1582                                 . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocal()); 
     1582                                . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocalColumnName()); 
    15831583 
    15841584                    if ($relation->isEqual()) { 
     
    15891589                                    . $table->getColumnName($table->getIdentifier())) 
    15901590                                    . ' = ' 
    1591                                     . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeign()); 
     1591                                    . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeignColumnName()); 
    15921592                    } 
    15931593 
     
    16341634        if ( ! $overrideJoin) { 
    16351635            $queryPart .= ' ON ' 
    1636                        . $this->_conn->quoteIdentifier($localAlias . '.' . $relation->getLocal()) 
     1636                       . $this->_conn->quoteIdentifier($localAlias . '.' . $relation->getLocalColumnName()) 
    16371637                       . ' = ' 
    1638                        . $this->_conn->quoteIdentifier($foreignAlias . '.' . $relation->getForeign()); 
     1638                       . $this->_conn->quoteIdentifier($foreignAlias . '.' . $relation->getForeignColumnName()); 
    16391639        } 
    16401640 
     
    16841684        $queryPart .= $this->_conn->quoteIdentifier($foreignAlias . '.' . $localIdentifier) 
    16851685                    . ' = ' 
    1686                     . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeign()); 
     1686                    . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeignColumnName()); 
    16871687 
    16881688        if ($relation->isEqual()) { 
     
    16901690                        . $this->_conn->quoteIdentifier($foreignAlias . '.' . $localIdentifier) 
    16911691                        . ' = ' 
    1692                         . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocal()) 
     1692                        . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocalColumnName()) 
    16931693                        . ') AND ' 
    16941694                        . $this->_conn->quoteIdentifier($foreignAlias . '.' . $localIdentifier) 
  • branches/1.0/lib/Doctrine/Relation.php

    r4890 r5095  
    274274 
    275275    /** 
     276     * getLocalColumnName 
     277     * returns the column name of the local column 
     278     * 
     279     * @return string $columnName 
     280     */ 
     281    final public function getLocalColumnName() 
     282    { 
     283        return $this->definition['localTable']->getColumnName($this->definition['local']); 
     284    } 
     285 
     286    /** 
    276287     * getForeign 
    277288     * returns the name of the foreignkey column where 
     
    287298    /** 
    288299     * getLocalFieldName 
    289      * returns the field name of the local column 
     300     * returns the field name of the foreign column 
    290301     */ 
    291302    final public function getForeignFieldName() 
    292303    { 
    293304        return $this->definition['table']->getFieldName($this->definition['foreign']); 
     305    } 
     306 
     307    /** 
     308     * getForeignColumnName 
     309     * returns the column name of the foreign column 
     310     * 
     311     * @return string $columnName 
     312     */ 
     313    final public function getForeignColumnName() 
     314    { 
     315       return $this->definition['table']->getColumnName($this->definition['foreign']); 
    294316    } 
    295317 
  • branches/1.1/lib/Doctrine/Query.php

    r5073 r5095  
    16361636                                . $localTable->getColumnName($localTable->getIdentifier())) // what about composite keys? 
    16371637                                . ' = ' 
    1638                                 . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocal()); 
     1638                                . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocalColumnName()); 
    16391639 
    16401640                    if ($relation->isEqual()) { 
     
    16451645                                    . $table->getColumnName($table->getIdentifier())) 
    16461646                                    . ' = ' 
    1647                                     . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeign()); 
     1647                                    . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeignColumnName()); 
    16481648                    } 
    16491649 
     
    16901690        if ( ! $overrideJoin) { 
    16911691            $queryPart .= ' ON ' 
    1692                        . $this->_conn->quoteIdentifier($localAlias . '.' . $relation->getLocal()) 
     1692                       . $this->_conn->quoteIdentifier($localAlias . '.' . $relation->getLocalColumnName()) 
    16931693                       . ' = ' 
    1694                        . $this->_conn->quoteIdentifier($foreignAlias . '.' . $relation->getForeign()); 
     1694                       . $this->_conn->quoteIdentifier($foreignAlias . '.' . $relation->getForeignColumnName()); 
    16951695        } 
    16961696 
     
    17441744        $queryPart .= $this->_conn->quoteIdentifier($foreignAlias . '.' . $localIdentifier) 
    17451745                    . ' = ' 
    1746                     . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeign()); 
     1746                    . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeignColumnName()); 
    17471747 
    17481748        if ($relation->isEqual()) { 
     
    17501750                        . $this->_conn->quoteIdentifier($foreignAlias . '.' . $localIdentifier) 
    17511751                        . ' = ' 
    1752                         . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocal()) 
     1752                        . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocalColumnName()) 
    17531753                        . ') AND ' 
    17541754                        . $this->_conn->quoteIdentifier($foreignAlias . '.' . $localIdentifier) 
  • branches/1.1/lib/Doctrine/Relation.php

    r4890 r5095  
    274274 
    275275    /** 
     276     * getLocalColumnName 
     277     * returns the column name of the local column 
     278     * 
     279     * @return string $columnName 
     280     */ 
     281    final public function getLocalColumnName() 
     282    { 
     283        return $this->definition['localTable']->getColumnName($this->definition['local']); 
     284    } 
     285 
     286    /** 
    276287     * getForeign 
    277288     * returns the name of the foreignkey column where 
     
    287298    /** 
    288299     * getLocalFieldName 
    289      * returns the field name of the local column 
     300     * returns the field name of the foreign column 
    290301     */ 
    291302    final public function getForeignFieldName() 
    292303    { 
    293304        return $this->definition['table']->getFieldName($this->definition['foreign']); 
     305    } 
     306 
     307    /** 
     308     * getForeignColumnName 
     309     * returns the column name of the foreign column 
     310     * 
     311     * @return string $columnName 
     312     */ 
     313    final public function getForeignColumnName() 
     314    { 
     315       return $this->definition['table']->getColumnName($this->definition['foreign']); 
    294316    } 
    295317