@@ -86,20 +86,23 @@ public function indexAction(Request $request, $_format)
8686 $ cache = new ConfigCache ($ this ->exposedRoutesExtractor ->getCachePath ($ request ->getLocale ()), $ this ->debug );
8787
8888 if (!$ cache ->isFresh ()) {
89- $ content = $ this ->serializer ->serialize (
90- new RoutesResponse (
91- $ this ->exposedRoutesExtractor ->getBaseUrl (),
92- $ this ->exposedRoutesExtractor ->getRoutes (),
93- $ this ->exposedRoutesExtractor ->getPrefix ($ request ->getLocale ()),
94- $ this ->exposedRoutesExtractor ->getHost (),
95- $ this ->exposedRoutesExtractor ->getScheme ()
96- ),
97- 'json '
98- );
99- $ cache ->write ($ content , $ this ->exposedRoutesExtractor ->getResources ());
89+ $ exposedRoutes = $ this ->exposedRoutesExtractor ->getRoutes ();
90+ $ serializedRoutes = $ this ->serializer ->serialize ($ exposedRoutes , 'json ' );
91+ $ cache ->write ($ serializedRoutes , $ this ->exposedRoutesExtractor ->getResources ());
92+ } else {
93+ $ serializedRoutes = file_get_contents ((string ) $ cache );
94+ $ exposedRoutes = json_decode ($ serializedRoutes , true );
10095 }
10196
102- $ content = file_get_contents ((string ) $ cache );
97+ $ routesResponse = new RoutesResponse (
98+ $ this ->exposedRoutesExtractor ->getBaseUrl (),
99+ $ exposedRoutes ,
100+ $ this ->exposedRoutesExtractor ->getPrefix ($ request ->getLocale ()),
101+ $ this ->exposedRoutesExtractor ->getHost (),
102+ $ this ->exposedRoutesExtractor ->getScheme ()
103+ );
104+
105+ $ content = $ this ->serializer ->serialize ($ routesResponse , 'json ' );
103106
104107 if (null !== $ callback = $ request ->query ->get ('callback ' )) {
105108 $ validator = new \JsonpCallbackValidator ();
0 commit comments