File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/LiveComponent/src/Util Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1414use Symfony \Component \Routing \Exception \MethodNotAllowedException ;
1515use Symfony \Component \Routing \Exception \MissingMandatoryParametersException ;
1616use Symfony \Component \Routing \Exception \ResourceNotFoundException ;
17+ use Symfony \Component \Routing \Matcher \UrlMatcher ;
18+ use Symfony \Component \Routing \Matcher \UrlMatcherInterface ;
1719use Symfony \Component \Routing \RouterInterface ;
1820
1921/**
2022 * @internal
2123 */
2224class UrlFactory
2325{
26+ private UrlMatcherInterface $ matcher ;
27+
2428 public function __construct (
2529 private RouterInterface $ router ,
2630 ) {
31+ $ context = clone $ this ->router ->getContext ();
32+ $ context ->setMethod ('GET ' );
33+ $ this ->matcher = new UrlMatcher (
34+ routes: $ this ->router ->getRouteCollection (),
35+ context: $ context ,
36+ );
2737 }
2838
2939 public function createFromPreviousAndProps (
@@ -61,7 +71,7 @@ public function createFromPreviousAndProps(
6171 private function createPath (string $ previousUrl , array $ props ): string
6272 {
6373 return $ this ->router ->generate (
64- $ this ->router ->match ($ previousUrl )['_route ' ] ?? '' ,
74+ $ this ->matcher ->match ($ previousUrl )['_route ' ] ?? '' ,
6575 $ props
6676 );
6777 }
You can’t perform that action at this time.
0 commit comments