forked from sonata-project/SonataCacheBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSonataCacheBundle.php
38 lines (31 loc) · 1.06 KB
/
SonataCacheBundle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/*
* This file is part of the Sonata project.
*
* (c) Thomas Rabaix <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\CacheBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Sonata\CacheBundle\DependencyInjection\Compiler\CacheCompilerPass;
class SonataCacheBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new CacheCompilerPass());
}
public function boot()
{
$options = $this->container->getParameter('twig.options');
if (!isset($options['base_template_class'])) {
return;
}
if (method_exists($options['base_template_class'], 'attachRecorder')) {
call_user_func(array($options['base_template_class'], 'attachRecorder'), $this->container->get('sonata.cache.recorder'));
}
}
}