-
-
Save doctrinebot/e8377649146f9ddfdcac to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-162 - https://github.com/doctrine/doctrine2/issues/2260
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index cec6d51..d3dd1a3 100644 | |
--- lib/Doctrine/ORM/Persisters/StandardEntityPersister.php | |
+++ lib/Doctrine/ORM/Persisters/StandardEntityPersister.php | |
@@ -405,7 +405,13 @@ class StandardEntityPersister | |
*/ | |
public function load(array $criteria, $entity = null, $assoc = null, array $hints = array()) | |
{ | |
- $stmt = $this->_conn->prepare($this->_getSelectEntitiesSql($criteria, $assoc)); | |
+ $sqlLogger = $this->_conn->getConfiguration()->getSqlLogger(); | |
+ $sql = $this->_getSelectEntitiesSql($criteria, $assoc); | |
+ if ($sqlLogger) { | |
+ $sqlLogger->logSql($sql, array_values($criteria)); | |
+ } | |
+ | |
+ $stmt = $this->_conn->prepare($sql); | |
$stmt->execute(array_values($criteria)); | |
$result = $stmt->fetch(Connection::FETCH_ASSOC); | |
$stmt->closeCursor(); | |
@@ -421,7 +427,13 @@ class StandardEntityPersister | |
*/ | |
final public function refresh(array $id, $entity) | |
{ | |
- $stmt = $this->_conn->prepare($this->_getSelectEntitiesSql($id)); | |
+ $sqlLogger = $this->_conn->getConfiguration()->getSqlLogger(); | |
+ $sql = $this->_getSelectEntitiesSql($id); | |
+ if ($sqlLogger) { | |
+ $sqlLogger->logSql($sql, array_values($id)); | |
+ } | |
+ | |
+ $stmt = $this->_conn->prepare($sql); | |
$stmt->execute(array_values($id)); | |
$result = $stmt->fetch(Connection::FETCH_ASSOC); | |
$stmt->closeCursor(); | |
@@ -503,7 +515,13 @@ class StandardEntityPersister | |
{ | |
$entities = array(); | |
- $stmt = $this->_conn->prepare($this->_getSelectEntitiesSql($criteria)); | |
+ $sqlLogger = $this->_conn->getConfiguration()->getSqlLogger(); | |
+ $sql = $this->_getSelectEntitiesSql($criteria); | |
+ if ($sqlLogger) { | |
+ $sqlLogger->logSql($sql, array_values($criteria)); | |
+ } | |
+ | |
+ $stmt = $this->_conn->prepare($sql); | |
$stmt->execute(array_values($criteria)); | |
$result = $stmt->fetchAll(Connection::FETCH_ASSOC); | |
$stmt->closeCursor(); | |
@@ -523,8 +541,14 @@ class StandardEntityPersister | |
*/ | |
public function loadOneToManyCollection(array $criteria, PersistentCollection $coll) | |
{ | |
+ $sqlLogger = $this->_conn->getConfiguration()->getSqlLogger(); | |
+ $sql = $this->_getSelectEntitiesSql($criteria, $owningAssoc); | |
+ if ($sqlLogger) { | |
+ $sqlLogger->logSql($sql, array_values($criteria)); | |
+ } | |
+ | |
$owningAssoc = $this->_class->associationMappings[$coll->getMapping()->mappedByFieldName]; | |
- $stmt = $this->_conn->prepare($this->_getSelectEntitiesSql($criteria, $owningAssoc)); | |
+ $stmt = $this->_conn->prepare($sql); | |
$stmt->execute(array_values($criteria)); | |
while ($result = $stmt->fetch(Connection::FETCH_ASSOC)) { | |
$coll->hydrateAdd($this->_createEntity($result)); | |
@@ -540,7 +564,13 @@ class StandardEntityPersister | |
*/ | |
public function loadManyToManyCollection($assoc, array $criteria, PersistentCollection $coll) | |
{ | |
- $stmt = $this->_conn->prepare($this->_getSelectManyToManyEntityCollectionSql($assoc, $criteria)); | |
+ $sqlLogger = $this->_conn->getConfiguration()->getSqlLogger(); | |
+ $sql = $this->_getSelectManyToManyEntityCollectionSql($assoc, $criteria); | |
+ if ($sqlLogger) { | |
+ $sqlLogger->logSql($sql, array_values($criteria)); | |
+ } | |
+ | |
+ $stmt = $this->_conn->prepare($sql); | |
$stmt->execute(array_values($criteria)); | |
while ($result = $stmt->fetch(Connection::FETCH_ASSOC)) { | |
$coll->hydrateAdd($this->_createEntity($result)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment