[FrameworkBundle] added cache warmer priority

This commit is contained in:
Kris Wallsmith 2011-02-02 14:47:33 -08:00 committed by Fabien Potencier
parent 6b7e4ad2f9
commit ea536b0d9e

View File

@ -33,9 +33,14 @@ class AddCacheWarmerPass implements CompilerPassInterface
$warmers = array();
foreach ($container->findTaggedServiceIds('kernel.cache_warmer') as $id => $attributes) {
$warmers[] = new Reference($id);
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
$warmers[$priority][] = new Reference($id);
}
// sort by priority and flatten
krsort($warmers);
$warmers = call_user_func_array('array_merge', $warmers);
$container->getDefinition('cache_warmer')->setArgument(0, $warmers);
if ('full' === $container->getParameter('kernel.cache_warmup')) {