Completed
Push — 2.x-dev-kit ( 3d52ae )
by
unknown
09:33
created

SonataCacheBundle::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\CacheBundle;
13
14
use Sonata\CacheBundle\DependencyInjection\Compiler\CacheCompilerPass;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\HttpKernel\Bundle\Bundle;
17
18
class SonataCacheBundle extends Bundle
19
{
20
    public function build(ContainerBuilder $container)
21
    {
22
        parent::build($container);
23
24
        $container->addCompilerPass(new CacheCompilerPass());
25
    }
26
27
    public function boot()
28
    {
29
        $baseTemplateClass = $this->container->get('twig')->getBaseTemplateClass();
30
31
        if (empty($baseTemplateClass)) {
32
            return;
33
        }
34
35
        if (method_exists($baseTemplateClass, 'attachRecorder')) {
36
            call_user_func(array($baseTemplateClass, 'attachRecorder'), $this->container->get('sonata.cache.recorder'));
37
        }
38
    }
39
}
40