Skip to content

Commit

Permalink
Modified Hydrators to be per-query instances instead of a singleton-l…
Browse files Browse the repository at this point in the history
…ike approach.
  • Loading branch information
Guilherme Blanco authored and beberlei committed Aug 10, 2013
1 parent ec36e2c commit 453a566
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 36 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/AbstractQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ public function execute($parameters = null, $hydrationMode = null)
return $stmt;
}

$data = $this->_em->getHydrator($this->_hydrationMode)->hydrateAll(
$data = $this->_em->newHydrator($this->_hydrationMode)->hydrateAll(
$stmt, $this->_resultSetMapping, $this->_hints
);

Expand Down
8 changes: 0 additions & 8 deletions lib/Doctrine/ORM/Decorator/EntityManagerDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,6 @@ public function getUnitOfWork()
return $this->wrapped->getUnitOfWork();
}

/**
* {@inheritdoc}
*/
public function getHydrator($hydrationMode)
{
return $this->wrapped->getHydrator($hydrationMode);
}

/**
* {@inheritdoc}
*/
Expand Down
26 changes: 0 additions & 26 deletions lib/Doctrine/ORM/EntityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@
*/
private $eventManager;

/**
* The maintained (cached) hydrators. One instance per type.
*
* @var array
*/
private $hydrators = array();

/**
* The proxy factory used to create dynamic proxies.
*
Expand Down Expand Up @@ -834,25 +827,6 @@ public function getUnitOfWork()
return $this->unitOfWork;
}

/**
* Gets a hydrator for the given hydration mode.
*
* This method caches the hydrator instances which is used for all queries that don't
* selectively iterate over the result.
*
* @param int $hydrationMode
*
* @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator
*/
public function getHydrator($hydrationMode)
{
if ( ! isset($this->hydrators[$hydrationMode])) {
$this->hydrators[$hydrationMode] = $this->newHydrator($hydrationMode);
}

return $this->hydrators[$hydrationMode];
}

/**
* Create a new instance for the given hydration mode.
*
Expand Down
1 change: 0 additions & 1 deletion lib/Doctrine/ORM/EntityManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function getEventManager();
public function getConfiguration();
public function isOpen();
public function getUnitOfWork();
public function getHydrator($hydrationMode);
public function newHydrator($hydrationMode);
public function getProxyFactory();
public function getFilters();
Expand Down

0 comments on commit 453a566

Please sign in to comment.