From 3a0166e268b5816ca41989bdf64a52211733722b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20In=C3=A1cio?= Date: Tue, 6 Dec 2016 14:50:40 +0000 Subject: [PATCH] FIX EZS-1207: reverse matcher incorrect result (#694) * FIX EZS-1207: reverse matcher incorrect result --- SiteAccess/ReverseMatcher.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SiteAccess/ReverseMatcher.php b/SiteAccess/ReverseMatcher.php index 71bb51a..3e69791 100644 --- a/SiteAccess/ReverseMatcher.php +++ b/SiteAccess/ReverseMatcher.php @@ -6,6 +6,7 @@ use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Map\Host; use eZ\Publish\Core\MVC\Symfony\SiteAccess\MatcherBuilder; use eZ\Publish\Core\MVC\Symfony\SiteAccess\VersatileMatcher; +use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\CompoundInterface; use eZ\Publish\Core\MVC\Exception\InvalidSiteAccessException; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\HttpFoundation\RequestStack; @@ -51,8 +52,12 @@ public function getMatcher($siteAccessName) foreach ($this->siteAccessesConfiguration as $matchingClass => $matchingConfiguration) { $matcher = $this->matcherBuilder->buildMatcher($matchingClass, $matchingConfiguration, new SimplifiedRequest()); - if ($matcher instanceof VersatileMatcher) { - return $matcher->reverseMatch($siteAccessName); + if ($matcher instanceof CompoundInterface) { + $matcher->setMatcherBuilder($this->matcherBuilder); + } + + if ($matcher instanceof VersatileMatcher && $reverseMatch = $matcher->reverseMatch($siteAccessName)) { + return $reverseMatch; } }