Completed
Push — component-bundle ( 0f1f3e...87da48 )
by Kamil
22:12
created

SyliusResourceBundle::getModelNamespace()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\ResourceBundle;
13
14
use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\DoctrineTargetEntitiesResolverPass;
15
use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterFormBuilderPass;
16
use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterResourceRepositoryPass;
17
use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterResourcesPass;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
20
/**
21
 * @author Paweł Jędrzejewski <[email protected]>
22
 */
23
final class SyliusResourceBundle extends AbstractResourceBundle
24
{
25
    const DRIVER_DOCTRINE_ORM = 'doctrine/orm';
26
    const DRIVER_DOCTRINE_MONGODB_ODM = 'doctrine/mongodb-odm';
27
    const DRIVER_DOCTRINE_PHPCR_ODM = 'doctrine/phpcr-odm';
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function getSupportedDrivers()
33
    {
34
        return self::getAvailableDrivers();
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function build(ContainerBuilder $container)
41
    {
42
        parent::build($container);
43
44
        $container->addCompilerPass(new RegisterResourcesPass());
45
        $container->addCompilerPass(new DoctrineTargetEntitiesResolverPass());
46
        $container->addCompilerPass(new RegisterResourceRepositoryPass());
47
        $container->addCompilerPass(new RegisterFormBuilderPass());
48
    }
49
50
    /**
51
     * @return string[]
52
     */
53
    public static function getAvailableDrivers()
54
    {
55
        return [
56
            self::DRIVER_DOCTRINE_ORM,
57
            self::DRIVER_DOCTRINE_MONGODB_ODM,
58
            self::DRIVER_DOCTRINE_PHPCR_ODM,
59
        ];
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    protected function getModelNamespace()
66
    {
67
        return 'Sylius\Component\Resource\Model';
68
    }
69
}
70