8000 [HttpKernel] removed the need to keep the compiled classes in the con… · barros001/symfony@eb7c86b · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit eb7c86b

Browse files
committed
[HttpKernel] removed the need to keep the compiled classes in the container
1 parent e16c226 commit eb7c86b

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\DependencyInjection\ContainerBuilder;
1515
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1616
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
17+
use Symfony\Component\HttpKernel\Kernel;
1718

1819
/**
1920
* Sets the classes to compile in the cache for the container.
@@ -22,6 +23,13 @@
2223
*/
2324
class AddClassesToCachePass implements CompilerPassInterface
2425
{
26+
private $kernel;
27+
28+
public function __construct(Kernel $kernel)
29+
{
30+
$this->kernel = $kernel;
31+
}
32+
2533
/**
2634
* {@inheritDoc}
2735
*/
@@ -34,6 +42,6 @@ public function process(ContainerBuilder $container)
3442
}
3543
}
3644

37-
$container->setParameter('kernel.compiled_classes', array_unique($classes));
45+
$this->kernel->setClassCache($container->getParameterBag()->resolveValue(array_unique($classes)));
3846
}
3947
}

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
2121
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
2222
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
23-
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
2423
use Symfony\Component\HttpFoundation\Request;
2524
use Symfony\Component\HttpKernel\HttpKernelInterface;
2625
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
@@ -402,6 +401,14 @@ public function loadClassCache($name = 'classes', $extension = '.php')
402401
}
403402
}
404403

404+
/**
405+
* Used internally.
406+
*/
407+
public function setClassCache(array $classes)
408+
{
409+
file_put_contents($this->getCacheDir().'/classes.map', sprintf('<?php return %s;', var_export($classes, true)));
410+
}
411+
405412
/**
406413
* Gets the request start time (not available if debug is disabled).
407414
*
@@ -641,8 +648,6 @@ protected function buildContainer()
641648
$container->addCompilerPass(new AddClassesToCachePass($this));
642649
$container->compile();
643650

644-
file_put_contents($this->getCacheDir().'/classes.map', sprintf('<?php return %s;', var_export($container->getParameter('kernel.compiled_classes'), true)));
645-
646651
return $container;
647652
}
648653

0 commit comments

Comments
 (0)
0