1
0
mirror of synced 2024-12-13 22:56:04 +03:00
This commit is contained in:
zYne 2007-05-24 18:30:18 +00:00
parent b4bcc51c12
commit 6b86c9fa47
3 changed files with 18 additions and 6 deletions

View File

@ -162,12 +162,24 @@ class Doctrine_Hydrate
return $alias; return $alias;
} }
/**
public function hasAlias($tableName) * hasTableAlias
* whether or not this object has given tableAlias
*
* @param string $tableAlias the table alias to be checked
* @return boolean true if this object has given alias, otherwise false
*/
public function hasTableAlias($tableAlias)
{ {
return (isset($this->_tableAliases[$tableName])); return (isset($this->_tableAliases[$tableAlias]));
} }
/**
* getComponentAlias
* get component alias associated with given table alias
*
* @param string $tableAlias the table alias that identifies the component alias
* @return string component alias
*/
public function getComponentAlias($tableAlias) public function getComponentAlias($tableAlias)
{ {
if ( ! isset($this->_tableAliases[$tableAlias])) { if ( ! isset($this->_tableAliases[$tableAlias])) {

View File

@ -755,7 +755,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
continue; continue;
} }
if($this->hasAlias($part)) { if($this->hasTableAlias($part)) {
$parts[$k] = $this->generateNewTableAlias($part); $parts[$k] = $this->generateNewTableAlias($part);
} }

View File

@ -135,7 +135,7 @@ class Doctrine_RawSql extends Doctrine_Query_Abstract
throw new Doctrine_RawSql_Exception('All selected fields in Sql query must be in format tableAlias.fieldName'); throw new Doctrine_RawSql_Exception('All selected fields in Sql query must be in format tableAlias.fieldName');
} }
// try to auto-add component // try to auto-add component
if ( ! $this->hasAlias($e[0])) { if ( ! $this->hasTableAlias($e[0])) {
try { try {
$this->addComponent($e[0], ucwords($e[0])); $this->addComponent($e[0], ucwords($e[0]));
} catch(Doctrine_Exception $exception) { } catch(Doctrine_Exception $exception) {