Closed somoza closed 3 years ago
Problem located. ReflectionClass is not able to ignore parent classes... Looking forward to a solution.
Any update so far?
Oh wow, this totally slipped through my net. I'll take a look this weekend
I found a little fix for solve this problem if you go to annotations\src\Routing\Annotations\AnnotationSet.php
protected function getMethodAnnotations(ReflectionClass $class, SimpleAnnotationReader $reader)
{
$annotations = [];
foreach ($class->getMethods() as $method) {
if($method->class == $class->name) {
$results = $reader->getMethodAnnotations($method);
if (count($results) > 0) {
$annotations[$method->name] = $results;
}
}
}
return $annotations;
}
the validation
if($method->class == $class->name)
make the difference.
Thanks @isa95Ar , sounds like a good approach.
I've prepared this pull request based on @isa95Ar suggestion. https://github.com/LaravelCollective/annotations/pull/104
Merged into 8.0
If I extend a class on the controller, the routes get repeated... For example, I've 5 controllers that extend a common controller X. The X controller routes are being added 6 times into routes.scanned.php and Laravel 8 complains about repeated route names.
Thanks!