@@ -29,6 +29,13 @@ class CacheManager extends CacheInvalidator
2929 */
3030 private $ urlGenerator ;
3131
32+ /**
33+ * What type of urls to generate.
34+ *
35+ * @var bool|string
36+ */
37+ private $ generateUrlType = UrlGeneratorInterface::ABSOLUTE_PATH ;
38+
3239 /**
3340 * Constructor
3441 *
@@ -41,6 +48,16 @@ public function __construct(ProxyClientInterface $cache, UrlGeneratorInterface $
4148 $ this ->urlGenerator = $ urlGenerator ;
4249 }
4350
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+
4461 /**
4562 * Assign cache tags to a response
4663 *
@@ -80,7 +97,7 @@ public function tagResponse(Response $response, array $tags, $replace = false)
8097 */
8198 public function invalidateRoute ($ name , array $ parameters = array (), array $ headers = array ())
8299 {
83- $ this ->invalidatePath ($ this ->urlGenerator ->generate ($ name , $ parameters ), $ headers );
100+ $ this ->invalidatePath ($ this ->urlGenerator ->generate ($ name , $ parameters, $ this -> generateUrlType ), $ headers );
84101
85102 return $ this ;
86103 }
@@ -96,7 +113,7 @@ public function invalidateRoute($name, array $parameters = array(), array $heade
96113 */
97114 public function refreshRoute ($ route , array $ parameters = array (), array $ headers = array ())
98115 {
99- $ this ->refreshPath ($ this ->urlGenerator ->generate ($ route , $ parameters ), $ headers );
116+ $ this ->refreshPath ($ this ->urlGenerator ->generate ($ route , $ parameters, $ this -> generateUrlType ), $ headers );
100117
101118 return $ this ;
102119 }
0 commit comments