Completed
Push — master ( a4c720...062952 )
by Guillaume
02:44
created

AbstractCommand::getRepository()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Starkerxp\StructureBundle\Command;
4
5
6
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
abstract class AbstractCommand extends ContainerAwareCommand
11
{
12
    /**
13
     * @var OutputInterface
14
     */
15
    protected $output;
16
    /**
17
     * @var InputInterface
18
     */
19
    protected $input;
20
21
22
    /**
23
     * @param InputInterface $input
24
     * @param OutputInterface $output
25
     *
26
     * @return bool
27
     */
28
    public function execute(InputInterface $input, OutputInterface $output)
29
    {
30
        $this->input = $input;
31
        $this->output = $output;
32
        $this->traitement();
33
34
        return true;
35
    }
36
37
    abstract public function traitement();
38
39
    protected function getRepository($entityFqdn)
40
    {
41
        return $this->getEntityManager()->getRepository($entityFqdn);
42
    }
43
44
    protected function getEntityManager()
45
    {
46
        return $this->getContainer()->get("doctrine")->getManager();
47
    }
48
49
    protected function getConnection()
50
    {
51
        return $this->getContainer()->get("doctrine")->getConnection();
52
    }
53
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
54