Skip to content

Commit

Permalink
only use already existing reflections
Browse files Browse the repository at this point in the history
  • Loading branch information
Padam87 committed Mar 26, 2013
1 parent 521276f commit bb5bdcf
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/Doctrine/ORM/Tools/EntityGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit bb5bdcf

Please sign in to comment.