From c1e688fc812f68d0f68c2135d46303fdb22ea23a Mon Sep 17 00:00:00 2001 From: "Fabio B. Silva" Date: Wed, 12 Jun 2013 10:29:17 -0400 Subject: [PATCH] drop useless support for associations --- .../Hydration/SimpleObjectHydrator.php | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php index 412ad41e2..eb0982c7d 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php @@ -146,8 +146,8 @@ class SimpleObjectHydrator extends AbstractHydrator { if (isset($this->_rsm->fieldMappings[$column])) { - $name = $this->_rsm->fieldMappings[$column]; - $class = isset($this->declaringClasses[$column]) + $name = $this->_rsm->fieldMappings[$column]; + $class = isset($this->declaringClasses[$column]) ? $this->declaringClasses[$column] : $this->class; @@ -162,21 +162,6 @@ class SimpleObjectHydrator extends AbstractHydrator ); } - if (isset($this->_rsm->relationMap[$column])) { - $class = isset($this->_rsm->relationMap[$column]) - ? $this->_rsm->relationMap[$column] - : $this->class; - - // If class is not self referencing, ignore - if ( ! ($class === $entityName || is_subclass_of($entityName, $class))) { - return null; - } - - // TODO: Decide what to do with associations. It seems original code is incomplete. - // One solution is to load the association, but it might require extra efforts. - return array('name' => $column); - } - if (isset($this->_rsm->metaMappings[$column])) { return array( 'name' => $this->_rsm->metaMappings[$column], @@ -184,6 +169,11 @@ class SimpleObjectHydrator extends AbstractHydrator ); } + // An ObjectHydrator should be used instead of SimpleObjectHydrator + if (isset($this->_rsm->relationMap[$column])) { + throw new \Exception(sprintf('Unable to retrieve association information for column "%s"', $column)); + } + return null; } }