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 14
14
use Symfony \Component \Routing \Exception \MethodNotAllowedException ;
15
15
use Symfony \Component \Routing \Exception \MissingMandatoryParametersException ;
16
16
use Symfony \Component \Routing \Exception \ResourceNotFoundException ;
17
+ use Symfony \Component \Routing \Matcher \UrlMatcher ;
18
+ use Symfony \Component \Routing \Matcher \UrlMatcherInterface ;
17
19
use Symfony \Component \Routing \RouterInterface ;
18
20
19
21
/**
20
22
* @internal
21
23
*/
22
24
class UrlFactory
23
25
{
26
+ private UrlMatcherInterface $ matcher ;
27
+
24
28
public function __construct (
25
29
private RouterInterface $ router ,
26
30
) {
31
+ $ context = clone $ this ->router ->getContext ();
32
+ $ context ->setMethod ('GET ' );
33
+ $ this ->matcher = new UrlMatcher (
34
+ routes: $ this ->router ->getRouteCollection (),
35
+ context: $ context ,
36
+ );
27
37
}
28
38
29
39
public function createFromPreviousAndProps (
@@ -61,7 +71,7 @@ public function createFromPreviousAndProps(
61
71
private function createPath (string $ previousUrl , array $ props ): string
62
72
{
63
73
return $ this ->router ->generate (
64
- $ this ->router ->match ($ previousUrl )['_route ' ] ?? '' ,
74
+ $ this ->matcher ->match ($ previousUrl )['_route ' ] ?? '' ,
65
75
$ props
66
76
);
67
77
}
You can’t perform that action at this time.
0 commit comments