Completed
Pull Request — master (#290)
by Leny
08:38
created

GenerateViewReferenceCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 3
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 9 1
A execute() 0 7 1
1
<?php
2
3
namespace Victoire\Bundle\ViewReferenceBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
class GenerateViewReferenceCommand extends ContainerAwareCommand
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function configure()
15
    {
16
        parent::configure();
17
18
        $this
19
            ->setName('victoire:viewReference:generate')
20
            ->setAliases(['victoire:generate:view-cache'])
21
            ->setDescription('write view references in a xml cache file');
22
    }
23
24
    /**
25
     * Read declared business entities and BusinessEntityPatternPages to generate their urls.
26
     *
27
     * @param InputInterface  $input
28
     * @param OutputInterface $output
29
     *
30
     * @return void
31
     */
32
    protected function execute(InputInterface $input, OutputInterface $output)
33
    {
34
        $viewsReferences = $this->getContainer()->get('victoire_core.view_helper')->buildViewsReferences();
35
        $this->getContainer()->get('victoire_view_reference.cache.driver')->writeFile(
36
            $this->getContainer()->get('victoire_view_reference.cache.manager')->generateXml($viewsReferences)
37
        );
38
    }
39
}
40