Skip to content

Commit

Permalink
doctrine#1277 DDC-3346 DDC-3531 - moved selectColumnListSql into th…
Browse files Browse the repository at this point in the history
…e newly created `CachedPersisterContext`
  • Loading branch information
Ocramius committed Jan 24, 2015
1 parent 4c62d3b commit 55930a3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 42 deletions.
8 changes: 4 additions & 4 deletions lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,8 @@ protected final function getOrderBySQL(array $orderBy, $baseTableAlias)
protected function getSelectColumnsSQL(/*$hasLimitClause = false*/)
{
//if ( ! $hasLimitClause && $this->selectColumnListSql !== null) {
if ($this->selectColumnListSql !== null) {
return $this->selectColumnListSql;
if ($this->cachedPersisterContexts['noLimits']->selectColumnListSql !== null) {
return $this->cachedPersisterContexts['noLimits']->selectColumnListSql;
}

$columnList = array();
Expand Down Expand Up @@ -1288,9 +1288,9 @@ protected function getSelectColumnsSQL(/*$hasLimitClause = false*/)
$this->selectJoinSql .= implode(' AND ', $joinCondition);
}

$this->selectColumnListSql = implode(', ', $columnList);
$this->cachedPersisterContexts['noLimits']->selectColumnListSql = implode(', ', $columnList);

return $this->selectColumnListSql;
return $this->cachedPersisterContexts['noLimits']->selectColumnListSql;
}

/**
Expand Down
31 changes: 1 addition & 30 deletions lib/Doctrine/ORM/Persisters/Entity/CachedPersisterContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,40 +48,11 @@ class CachedPersisterContext
*/
public $rsm;

/**
* The map of column names to DBAL mapping types of all prepared columns used
* when INSERTing or UPDATEing an entity.
*
* @var array
*
* @see \Doctrine\ORM\Persisters\Entity\BasicEntityPersister#prepareInsertData($entity)
* @see \Doctrine\ORM\Persisters\Entity\BasicEntityPersister#prepareUpdateData($entity)
*/
public $columnTypes = array();

/**
* The map of quoted column names.
*
* @var array
*
* @see \Doctrine\ORM\Persisters\Entity\BasicEntityPersister#prepareInsertData($entity)
* @see \Doctrine\ORM\Persisters\Entity\BasicEntityPersister#prepareUpdateData($entity)
*/
public $quotedColumns = array();

/**
* The INSERT SQL statement used for entities handled by this persister.
* This SQL is only generated once per request, if at all.
*
* @var string
*/
public $insertSql = '';

/**
* The SELECT column list SQL fragment used for querying entities by this persister.
* This SQL fragment is only generated once per request, if at all.
*
* @var string
* @var string|null
*/
public $selectColumnListSql;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ protected function getLockTablesSql($lockMode)
protected function getSelectColumnsSQL()
{
// Create the column list fragment only once
if ($this->selectColumnListSql !== null) {
return $this->selectColumnListSql;
if ($this->cachedPersisterContexts['noLimits']->selectColumnListSql !== null) {
return $this->cachedPersisterContexts['noLimits']->selectColumnListSql;
}

$columnList = array();
Expand Down Expand Up @@ -523,9 +523,9 @@ protected function getSelectColumnsSQL()
}
}

$this->selectColumnListSql = implode(', ', $columnList);
$this->cachedPersisterContexts['noLimits']->selectColumnListSql = implode(', ', $columnList);

return $this->selectColumnListSql;
return $this->cachedPersisterContexts['noLimits']->selectColumnListSql;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/ORM/Persisters/Entity/SingleTablePersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ protected function getDiscriminatorColumnTableName()
*/
protected function getSelectColumnsSQL()
{
if ($this->selectColumnListSql !== null) {
return $this->selectColumnListSql;
if ($this->cachedPersisterContexts['noLimits']->selectColumnListSql !== null) {
return $this->cachedPersisterContexts['noLimits']->selectColumnListSql;
}

$columnList[] = parent::getSelectColumnsSQL();
Expand Down Expand Up @@ -106,9 +106,9 @@ protected function getSelectColumnsSQL()
}
}

$this->selectColumnListSql = implode(', ', $columnList);
$this->cachedPersisterContexts['noLimits']->selectColumnListSql = implode(', ', $columnList);

return $this->selectColumnListSql;
return $this->cachedPersisterContexts['noLimits']->selectColumnListSql;
}

/**
Expand Down

0 comments on commit 55930a3

Please sign in to comment.