diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index f55af76b193..c0e7b626749 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -462,6 +462,14 @@ private function _parseTokensInEntityFile($src) 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 @@ private function _hasProperty($property, ClassMetadataInfo $metadata) 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'])