Skip to content

Commit 816585d

Browse files
committed
Merge pull request #275 from frne/frontend-link-extension-routing-fix
Fixes error with unperisted dynamic route in sonata FrontendLinkExtension
2 parents f64a355 + e3ece82 commit 816585d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Admin/Extension/FrontendLinkExtension.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Sonata\AdminBundle\Admin\AdminExtension;
1616
use Sonata\AdminBundle\Admin\AdminInterface;
1717
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
18+
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\PrefixInterface;
1819
use Symfony\Cmf\Component\Routing\RouteReferrersReadInterface;
1920
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
2021
use Symfony\Component\Routing\Exception\ExceptionInterface as RoutingExceptionInterface;
@@ -68,6 +69,11 @@ public function configureTabMenu(
6869
);
6970
}
7071

72+
if ($subject instanceof PrefixInterface && !is_string($subject->getId())) {
73+
// we have an unpersisted dynamic route
74+
return;
75+
}
76+
7177
try {
7278
$uri = $this->router->generate($subject);
7379
} catch (RoutingExceptionInterface $e) {

0 commit comments

Comments
 (0)