GenerateViewReferenceCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 9 1
A execute() 0 8 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
use Victoire\Bundle\CoreBundle\Helper\ViewHelper;
9
10
class GenerateViewReferenceCommand extends ContainerAwareCommand
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function configure()
16
    {
17
        parent::configure();
18
19
        $this
20
            ->setName('victoire:viewReference:generate')
21
            ->setAliases(['victoire:generate:view-cache'])
22
            ->setDescription('write view references in a xml cache file');
23
    }
24
25
    /**
26
     * Read declared business entities and BusinessEntityPatternPages to generate their urls.
27
     *
28
     * @param InputInterface  $input
29
     * @param OutputInterface $output
30
     *
31
     * @return void
32
     */
33
    protected function execute(InputInterface $input, OutputInterface $output)
34
    {
35
        /** @var ViewHelper $viewHelper */
36
        $viewHelper = $this->getContainer()->get('victoire_core.view_helper');
37
        $viewsReferences = $viewHelper->buildViewsReferences();
38
        $this->getContainer()->get('victoire_view_reference.manager')->saveReferences($viewsReferences);
39
        $output->writeln('<info>The ViewReference has been generated.</info>');
40
    }
41
}
42