@@ -29,6 +29,13 @@ class CacheManager extends CacheInvalidator
29
29
*/
30
30
private $ urlGenerator ;
31
31
32
+ /**
33
+ * What type of urls to generate.
34
+ *
35
+ * @var bool|string
36
+ */
37
+ private $ generateUrlType = UrlGeneratorInterface::ABSOLUTE_PATH ;
38
+
32
39
/**
33
40
* Constructor
34
41
*
@@ -41,6 +48,16 @@ public function __construct(ProxyClientInterface $cache, UrlGeneratorInterface $
41
48
$ this ->urlGenerator = $ urlGenerator ;
42
49
}
43
50
51
+ /**
52
+ * Set what type of URLs to generate.
53
+ *
54
+ * @param bool|string $generateUrlType One of the constants in UrlGeneratorInterface
55
+ */
56
+ public function setGenerateUrlType ($ generateUrlType )
57
+ {
58
+ $ this ->generateUrlType = $ generateUrlType ;
59
+ }
60
+
44
61
/**
45
62
* Assign cache tags to a response
46
63
*
@@ -80,7 +97,7 @@ public function tagResponse(Response $response, array $tags, $replace = false)
80
97
*/
81
98
public function invalidateRoute ($ name , array $ parameters = array (), array $ headers = array ())
82
99
{
83
- $ this ->invalidatePath ($ this ->urlGenerator ->generate ($ name , $ parameters ), $ headers );
100
+ $ this ->invalidatePath ($ this ->urlGenerator ->generate ($ name , $ parameters, $ this -> generateUrlType ), $ headers );
84
101
85
102
return $ this ;
86
103
}
@@ -96,7 +113,7 @@ public function invalidateRoute($name, array $parameters = array(), array $heade
96
113
*/
97
114
public function refreshRoute ($ route , array $ parameters = array (), array $ headers = array ())
98
115
{
99
- $ this ->refreshPath ($ this ->urlGenerator ->generate ($ route , $ parameters ), $ headers );
116
+ $ this ->refreshPath ($ this ->urlGenerator ->generate ($ route , $ parameters, $ this -> generateUrlType ), $ headers );
100
117
101
118
return $ this ;
102
119
}
0 commit comments