Skip to content

Commit

Permalink
Merge pull request #275 from frne/frontend-link-extension-routing-fix
Browse files Browse the repository at this point in the history
Fixes error with unperisted dynamic route in sonata FrontendLinkExtension
  • Loading branch information
dbu committed Nov 20, 2014
2 parents f64a355 + e3ece82 commit 816585d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Admin/Extension/FrontendLinkExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Sonata\AdminBundle\Admin\AdminExtension;
use Sonata\AdminBundle\Admin\AdminInterface;
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\PrefixInterface;
use Symfony\Cmf\Component\Routing\RouteReferrersReadInterface;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Routing\Exception\ExceptionInterface as RoutingExceptionInterface;
Expand Down Expand Up @@ -68,6 +69,11 @@ public function configureTabMenu(
);
}

if ($subject instanceof PrefixInterface && !is_string($subject->getId())) {
// we have an unpersisted dynamic route
return;
}

try {
$uri = $this->router->generate($subject);
} catch (RoutingExceptionInterface $e) {
Expand Down

0 comments on commit 816585d

Please sign in to comment.