Completed
Push — 4.0 ( 268f2c...88f012 )
by Hideki
05:48 queued 10s
created

GenerateProxyCommand   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A configure() 0 5 1
A execute() 0 23 3
1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.ec-cube.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Eccube\Command;
15
16
use Doctrine\Common\Annotations\AnnotationRegistry;
17
use Eccube\Service\EntityProxyService;
18
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
19
use Symfony\Component\Console\Input\InputInterface;
20
use Symfony\Component\Console\Output\OutputInterface;
21
22
class GenerateProxyCommand extends ContainerAwareCommand
23
{
24
    protected static $defaultName = 'eccube:generate:proxies';
25
26
    /**
27
     * @var EntityProxyService
28
     */
29
    private $entityProxyService;
30
31
    public function __construct(EntityProxyService $entityProxyService)
32
    {
33
        parent::__construct();
34
        $this->entityProxyService = $entityProxyService;
35
    }
36
37
    protected function configure()
38
    {
39
        $this
40
            ->setDescription('Generate entity proxies');
41
    }
42
43
    protected function execute(InputInterface $input, OutputInterface $output)
44
    {
45
        // アノテーションを読み込めるように設定.
46
        AnnotationRegistry::registerAutoloadNamespace('Eccube\Annotation', __DIR__.'/../../../src');
0 ignored issues
show
Deprecated Code introduced by
The method Doctrine\Common\Annotati...sterAutoloadNamespace() has been deprecated with message: this method is deprecated and will be removed in doctrine/annotations 2.0 autoloading should be deferred to the globally registered autoloader by then. For now, use @example AnnotationRegistry::registerLoader('class_exists')

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
47
48
        $container = $this->getContainer();
49
        $projectDir = $container->getParameter('kernel.project_dir');
50
        $includeDirs = [$projectDir.'/app/Customize/Entity'];
51
52
        $enabledPlugins = $container->getParameter('eccube.plugins.enabled');
53
        foreach ($enabledPlugins as $code) {
54
            if (file_exists($projectDir.'/app/Plugin/'.$code.'/Entity')) {
55
                $includeDirs[] = $projectDir.'/app/Plugin/'.$code.'/Entity';
56
            }
57
        }
58
59
        $this->entityProxyService->generate(
60
            $includeDirs,
61
            [],
62
            $projectDir.'/app/proxy/entity',
63
            $output
64
        );
65
    }
66
}
67