Answer the question
In order to leave comments, you need to log in
How not to cache dynamic routes in Symfony?
I am trying to add my dynamic route as a service
#routes.yml
static_pages:
resource: 'pages.dynamic_routing_provider:getRoutes'
type: service</blockquote>
// Service.php
class DynamicRoutingProvider
{
public function getRoutes(): RouteCollection
{
$builder = new RouteCollectionBuilder();
$options = [
'cache_dir' => null,
'generator_cache_class' => null
];
$route = new Route('dynamic-pages', ['_controller' => 'PagesBundle:pages:preview'], [], $options);
$builder->addRoute($route);
return $builder->build();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question