forked from Dukecity/CommandSchedulerBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DukecityCommandSchedulerBundle.php
73 lines (63 loc) · 2.26 KB
/
DukecityCommandSchedulerBundle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace Dukecity\CommandSchedulerBundle;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
use Dukecity\CommandSchedulerBundle\DependencyInjection\DukecityCommandSchedulerExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Class DukecityCommandSchedulerBundle.
*/
class DukecityCommandSchedulerBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$ormCompilerClass = 'Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass';
if (class_exists($ormCompilerClass))
{
$namespaces = ['Dukecity\CommandSchedulerBundle\Entity'];
$directories = [realpath(__DIR__.'/Entity')];
$managerParameters = [];
$enabledParameter = false;
$aliasMap = ['CommandSchedulerBundle' => 'Dukecity\CommandSchedulerBundle\Entity'];
$driver = new Definition('Doctrine\ORM\Mapping\Driver\AttributeDriver', [$directories]);
$container->addCompilerPass(
new DoctrineOrmMappingsPass(
$driver,
$namespaces,
$managerParameters,
$enabledParameter,
$aliasMap
)
);
# TODO
/** If this is merged it could be renamed https://github.com/doctrine/DoctrineBundle/pull/1369/files
* new DoctrineOrmMappingsPass(
* DoctrineOrmMappingsPass::createPhpMappingDriver(
* $namespaces,
$directories,
$managerParameters,
$enabledParameter,
$aliasMap)
*/
}
}
/**
* {@inheritdoc}
*
* @return DukecityCommandSchedulerExtension
*/
public function getContainerExtension(): DukecityCommandSchedulerExtension
{
$class = $this->getContainerExtensionClass();
return new $class();
}
/**
* {@inheritdoc}
*/
protected function getContainerExtensionClass(): string
{
return DukecityCommandSchedulerExtension::class;
}
}