Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Update framework/db/ar/CActiveRecord.php #2048

Closed
wants to merge 4 commits into
from
@@ -1294,7 +1294,7 @@ protected function query($criteria,$all=false)
{
if(!$all)
$criteria->limit=1;
- $command=$this->getCommandBuilder()->createFindCommand($this->getTableSchema(),$criteria);
+ $command=$this->getCommandBuilder()->createFindCommand($this->getTableSchema(),$criteria,$this->getTableAlias(false));
@cebe

cebe Jan 30, 2013

Owner

$this->getTableAlias() is enough as false is default for 1st param.
Issue is valid and fix is fine.

return $all ? $this->populateRecords($command->queryAll(), true, $criteria->index) : $this->populateRecord($command->queryRow());
}
else
@@ -1611,7 +1611,7 @@ public function exists($condition='',$params=array())
$this->applyScopes($criteria);
if(empty($criteria->with))
- return $builder->createFindCommand($table,$criteria)->queryRow()!==false;
+ return $builder->createFindCommand($table,$criteria,$this->getTableAlias(false, false))->queryRow()!==false;
else
{
$criteria->select='*';