From 234253edd10664fae1ec2bec8b3fb1d26c546d71 Mon Sep 17 00:00:00 2001
From: romanb <romanb@625475ce-881a-0410-a577-b389adb331d8>
Date: Sat, 12 Apr 2008 20:24:28 +0000
Subject: [PATCH] Perf. improvement on hydrating joined resultsets, part 2.

---
 lib/Doctrine/Hydrator.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Doctrine/Hydrator.php b/lib/Doctrine/Hydrator.php
index 9877ee37f..fa3ef9932 100644
--- a/lib/Doctrine/Hydrator.php
+++ b/lib/Doctrine/Hydrator.php
@@ -180,8 +180,6 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
                 $listeners[$componentName]->preHydrate($event);
                 //--
 
-                $element = $driver->getElement($data, $componentName);
-
                 $parent = $map['parent'];
                 $relation = $map['relation'];
                 $relationAlias = $map['relation']->getAlias();
@@ -198,6 +196,7 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
                     // append element
                     if (isset($nonemptyComponents[$dqlAlias])) {
                         if ( ! isset($identifierMap[$path][$id[$parent]][$id[$dqlAlias]])) {
+                            $element = $driver->getElement($data, $componentName);
                             // just event stuff
                             $event->set('data', $element);
                             $listeners[$componentName]->postHydrate($event);
@@ -228,6 +227,7 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
                     if ( ! isset($nonemptyComponents[$dqlAlias])) {
                         $prev[$parent][$relationAlias] = $driver->getNullPointer();
                     } else {
+                        $element = $driver->getElement($data, $componentName);
                         $prev[$parent][$relationAlias] = $element;
                     }
                 }