From a283865ebcfe880d50a7433dd87362fd399191da Mon Sep 17 00:00:00 2001 From: frne Date: Tue, 18 Nov 2014 22:02:42 +0100 Subject: [PATCH 1/3] Fixes error with unperisted dynamic route --- Admin/Extension/FrontendLinkExtension.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Admin/Extension/FrontendLinkExtension.php b/Admin/Extension/FrontendLinkExtension.php index 9590f86e..9c467110 100644 --- a/Admin/Extension/FrontendLinkExtension.php +++ b/Admin/Extension/FrontendLinkExtension.php @@ -68,6 +68,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) { From df13b70cd69edf5b8330654721ff2b12d6258f47 Mon Sep 17 00:00:00 2001 From: Frank Neff Date: Wed, 19 Nov 2014 16:44:03 +0100 Subject: [PATCH 2/3] Code style fix --- Admin/Extension/FrontendLinkExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Admin/Extension/FrontendLinkExtension.php b/Admin/Extension/FrontendLinkExtension.php index 9c467110..0395c038 100644 --- a/Admin/Extension/FrontendLinkExtension.php +++ b/Admin/Extension/FrontendLinkExtension.php @@ -68,7 +68,7 @@ public function configureTabMenu( ); } - if($subject instanceof PrefixInterface && !is_string($subject->getId())) { + if ($subject instanceof PrefixInterface && !is_string($subject->getId())) { // we have an unpersisted dynamic route return; } From e3ece824911f38f76e308612fccc4c53718ff4ad Mon Sep 17 00:00:00 2001 From: frne Date: Wed, 19 Nov 2014 19:17:55 +0100 Subject: [PATCH 3/3] Ashamed to commit a namespace fix... --- Admin/Extension/FrontendLinkExtension.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Admin/Extension/FrontendLinkExtension.php b/Admin/Extension/FrontendLinkExtension.php index 0395c038..247a0331 100644 --- a/Admin/Extension/FrontendLinkExtension.php +++ b/Admin/Extension/FrontendLinkExtension.php @@ -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; @@ -68,7 +69,7 @@ public function configureTabMenu( ); } - if ($subject instanceof PrefixInterface && !is_string($subject->getId())) { + if ($subject instanceof PrefixInterface && !is_string($subject->getId())) { // we have an unpersisted dynamic route return; }