Skip to content

Commit

Permalink
entity generator - ignore trait properties and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Padam87 committed Mar 26, 2013
1 parent a4db7c8 commit 521276f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/Doctrine/ORM/Tools/EntityGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,15 @@ protected function hasProperty($property, ClassMetadataInfo $metadata)
}
}

// check traits for existing property
$reflClass = new \ReflectionClass($metadata->name);

foreach ($reflClass->getTraits() as $trait) {
if ($trait->hasProperty($property)) {
return true;
}
}

return (
isset($this->staticReflection[$metadata->name]) &&
in_array($property, $this->staticReflection[$metadata->name]['properties'])
Expand All @@ -732,6 +741,15 @@ protected function hasMethod($method, ClassMetadataInfo $metadata)
}
}

// check traits for existing method
$reflClass = new \ReflectionClass($metadata->name);

foreach ($reflClass->getTraits() as $trait) {
if ($trait->hasMethod($method)) {
return true;
}
}

return (
isset($this->staticReflection[$metadata->name]) &&
in_array($method, $this->staticReflection[$metadata->name]['methods'])
Expand Down

0 comments on commit 521276f

Please sign in to comment.