--- doctrine/lib/Doctrine/ORM/Mapping/ClassMetadata.php (r7029) Fri Jan 15 12:26:13 2010 +++ doctrine/lib/Doctrine/ORM/Mapping/ClassMetadata.php (working copy) Fri Jan 15 12:13:29 2010 @@ -359,16 +359,42 @@ // Restore ReflectionClass and properties $this->reflClass = new \ReflectionClass($this->name); foreach ($this->fieldNames as $field) { - $this->reflFields[$field] = $this->reflClass->getProperty($field); + $this->reflFields[$field] = $this->_getReflectionProperty($this->reflClass, $field); $this->reflFields[$field]->setAccessible(true); } foreach ($this->associationMappings as $field => $mapping) { - $this->reflFields[$field] = $this->reflClass->getProperty($field); + $this->reflFields[$field] = $this->_getReflectionProperty($this->reflClass, $field); $this->reflFields[$field]->setAccessible(true); } //$this->prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name)); } + /** + * Gets a reflection property for a class. + * @param \ReflectionClass $refClass + * @param string $field + * @return \ReflectionProperty + */ + private function _getReflectionProperty(\ReflectionClass $refClass, $field) + { + if(!$refClass->hasProperty($field)) + { + return NULL; + } + foreach($refClass->getProperties() as $p) + { + if($p->getName() == $field) + { + return $p; + } + } + if($parent = $refClass->getParentClass()) + { + return $this->_getReflectionProperty($parent, $field); + } + return NULL; + } + //public $prototype; }