update sitemap to use attributes instead of annotations

This commit is contained in:
Simon Vieille 2022-11-19 20:32:17 +01:00
parent 154e6d3e0b
commit 173ed9aa83
Signed by: deblan
GPG key ID: 579388D585F70417

View file

@ -137,13 +137,12 @@ class SitemapBuilder
protected function getAnnotation(Node $node)
{
try {
$annotation = $this->annotationReader->getMethodAnnotation(
new \ReflectionMethod($node->getController()),
UrlGenerator::class
);
$reflection = new \ReflectionMethod($node->getController());
if ($annotation) {
return $annotation;
foreach ($reflection->getAttributes() as $attribute) {
if (UrlGenerator::class === $attribute->getName()) {
return $attribute->newInstance();
}
}
} catch (\ReflectionException $e) {
return false;