GenerateViewReferenceCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
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