From 19bcf105ac90363c40d0bb71507043fbd92e31d0 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Thu, 22 Jan 2015 18:05:29 +0100 Subject: [PATCH] #1277 DDC-3346 DDC-3531 - moved `selectColumnListSql` into the newly created `CachedPersisterContext` --- .../Entity/BasicEntityPersister.php | 8 ++--- .../Entity/CachedPersisterContext.php | 31 +------------------ .../Entity/JoinedSubclassPersister.php | 8 ++--- .../Entity/SingleTablePersister.php | 8 ++--- 4 files changed, 13 insertions(+), 42 deletions(-) diff --git a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php index 30382581181..b56b9948410 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php @@ -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(); @@ -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; } /** diff --git a/lib/Doctrine/ORM/Persisters/Entity/CachedPersisterContext.php b/lib/Doctrine/ORM/Persisters/Entity/CachedPersisterContext.php index a148a54dda7..f3845d06e3b 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/CachedPersisterContext.php +++ b/lib/Doctrine/ORM/Persisters/Entity/CachedPersisterContext.php @@ -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; diff --git a/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php b/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php index 3ec9afc309f..5e1e6f6fe48 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php @@ -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(); @@ -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; } /** diff --git a/lib/Doctrine/ORM/Persisters/Entity/SingleTablePersister.php b/lib/Doctrine/ORM/Persisters/Entity/SingleTablePersister.php index b93c2afc9e5..8f1cf65d2c1 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/SingleTablePersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/SingleTablePersister.php @@ -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(); @@ -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; } /**