1

I've tested code form Symfony Docs in Symfony 3.2 and it was everything good, but cache doesn't work in 3.4.8.

Of courese I want to use Symfony Reverse Proxy.

My app_dev.php

$kernel = new AppKernel('dev', true);
if (PHP_VERSION_ID < 70000) {
    $kernel->loadClassCache();
}
$kernel = new AppCache($kernel);

My action look's like this:

public function indexAction(Request $request)
{
    // [...]
    $response = $this->render('base.html.twig');

    $response->setSharedMaxAge(3600);

        return $response;
}

Am I missing something, that isn't nessesery in Symfony 3.2?

Piotrek Zatorski
  • 494
  • 5
  • 15

2 Answers2

1

Symfony decided to deprecate the entire ClassLoader component for Symfony 3.3+.

In this case line below is no longer available

$kernel->loadClassCache(); // deprecated

In this case you should use class loader provided by Composer. If you are not using PHP 7.0 yet, you should stay with Symfony 3.2.


Useful links

New in Symfony 3.3: Deprecated the ClassLoader component

Autoloader Optimization

Karol Gasienica
  • 2,825
  • 24
  • 36
  • This statement is completely wrong. "deprecated" does not mean it "is no longer available" nor that it does not work. It work perfectly fine in both 3.3 and 3.4. It means it is not available in 4.0 which is not the case here. Compare [3.2](https://github.com/symfony/symfony/blob/3.2/src/Symfony/Component/HttpKernel/Kernel.php#L328) to [3.4](https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/HttpKernel/Kernel.php) – Cliff Edge Apr 28 '18 at 06:50
  • That's right, in addition HTTP Cache still doesn't work. – Piotrek Zatorski Apr 28 '18 at 12:02
0

I found it's imposible, by some Symfony 3.4 bug. I used Symfony Cache Component instead https://symfony.com/doc/current/components/cache.html.

Piotrek Zatorski
  • 494
  • 5
  • 15