From 598ab36968007d24b420f6eb59011edae48dc389 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Tue, 26 Jul 2011 22:59:55 +0200 Subject: [PATCH] [DDC-1215] Fix EntityGenerator inheritance regenerating properties and methods --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index f55af76b1..c0e7b6267 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -462,6 +462,14 @@ public function () private function _hasProperty($property, ClassMetadataInfo $metadata) { + if ($this->_extendsClass()) { + // don't generate property if its already on the base class. + $reflClass = new \ReflectionClass($this->_getClassToExtend()); + if ($reflClass->hasProperty($property)) { + return true; + } + } + return ( isset($this->_staticReflection[$metadata->name]) && in_array($property, $this->_staticReflection[$metadata->name]['properties']) @@ -470,6 +478,14 @@ public function () private function _hasMethod($method, ClassMetadataInfo $metadata) { + if ($this->_extendsClass()) { + // don't generate method if its already on the base class. + $reflClass = new \ReflectionClass($this->_getClassToExtend()); + if ($reflClass->hasMethod($method)) { + return true; + } + } + return ( isset($this->_staticReflection[$metadata->name]) && in_array($method, $this->_staticReflection[$metadata->name]['methods'])