Permalink
Browse files

only use already existing reflections

  • Loading branch information...
1 parent 521276f commit bb5bdcf0f4ccd6fc83692490ec70a697c90573fb @Padam87 committed Mar 26, 2013
Showing with 12 additions and 8 deletions.
  1. +12 −8 lib/Doctrine/ORM/Tools/EntityGenerator.php
@@ -710,11 +710,13 @@ protected function hasProperty($property, ClassMetadataInfo $metadata)
}
// check traits for existing property
- $reflClass = new \ReflectionClass($metadata->name);
+ if (isset($this->staticReflection[$metadata->name])) {
+ $reflClass = $this->staticReflection[$metadata->name];
- foreach ($reflClass->getTraits() as $trait) {
- if ($trait->hasProperty($property)) {
- return true;
+ foreach ($reflClass->getTraits() as $trait) {
+ if ($trait->hasProperty($property)) {
+ return true;
+ }
}
}
@@ -742,11 +744,13 @@ protected function hasMethod($method, ClassMetadataInfo $metadata)
}
// check traits for existing method
- $reflClass = new \ReflectionClass($metadata->name);
+ if (isset($this->staticReflection[$metadata->name])) {
+ $reflClass = $this->staticReflection[$metadata->name];
- foreach ($reflClass->getTraits() as $trait) {
- if ($trait->hasMethod($method)) {
- return true;
+ foreach ($reflClass->getTraits() as $trait) {
+ if ($trait->hasMethod($method)) {
+ return true;
+ }
}
}

0 comments on commit bb5bdcf

Please sign in to comment.