I am trying to disable the cache key in prod mode or make it recompile my views.
I use KnapLaps SnappyBundle to create some PDF files (the same problem occurs with DomPDF), and I have dynamic content for rendering.
In dev mode, I can change some text or even some css properties, the changes take effect immediately.
But in prod mode, I need to cache: clear or rm -rf app / cache / prod / twig / * to see the changes.
I tried the following options in my config.yml for the Twig section (not at the same time)
cache: "/dev/null" cache: false auto-reload: ~
I am also trying to create heading material when creating and replacing my pdf:
$html = $this->renderView("xxxxPdfBundle:Pdf:test.html.twig", array("foo" => $bar)); return new Response( $this->get('knp_snappy.pdf')->getOutputFromHtml($html), 200, array( 'Cache-Control' => 'no-cache, must-revalidate, post-check=0, pre-check=0', 'Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename='.$file ) );
I canβt figure out how to make the branch recompile or not use the application / cache, because obviously the contents of the pdf will be dynamic during production.
Update from comments:
I realized that even dynamic template variables were not updated, so the same PDF file was generated again and again in the production process, but not in development.
After clearing all the caches, this problem was fixed again: now PDF files with dynamic content are created, as was developed.
However, the question remains: what if, when my site is in production, I decided to change the CSS style in pdf format? CSS is not a template variable, and I cannot get people to clear their cache: /