1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Stefano Torresi (http://stefanotorresi.it) |
4
|
|
|
* @license See the file LICENSE.txt for copying permission. |
5
|
|
|
* ************************************************ |
6
|
|
|
* |
7
|
|
|
* This file is placed here for compatibility with Zendframework 2's ModuleManager. |
8
|
|
|
* It allows usage of this module even without composer. |
9
|
|
|
* The original Module.php is in 'src/{ModuleNamespace}' in order to respect PSR-0 |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Thorr\Persistence\Doctrine; |
13
|
|
|
|
14
|
|
|
use Doctrine\ORM\EntityManager; |
15
|
|
|
use Thorr\Persistence\DataMapper\Manager\DataMapperManagerConfigProviderInterface; |
16
|
|
|
use Zend\ModuleManager\Feature; |
17
|
|
|
|
18
|
|
|
class Module implements |
19
|
|
|
Feature\ConfigProviderInterface, |
20
|
|
|
DataMapperManagerConfigProviderInterface |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* {@inheritdoc} |
24
|
|
|
*/ |
25
|
3 |
|
public function getConfig() |
26
|
|
|
{ |
27
|
|
|
return [ |
28
|
|
|
'thorr_persistence_dmm' => [ |
29
|
|
|
'doctrine' => [ |
30
|
3 |
|
'object_manager' => EntityManager::class, // an ObjectManager service name |
31
|
|
|
'adapters' => [ |
32
|
|
|
/* |
33
|
|
|
* DataMapperServiceName => Spec |
34
|
|
|
* |
35
|
|
|
* Spec can be: |
36
|
|
|
* |
37
|
|
|
* a string representing a FQCN: |
38
|
|
|
* 'MyMapperService' => 'SomeDataMapperFQCN' |
39
|
|
|
* SomeDataMapper::class => SomeDataMapper::class |
40
|
|
|
* |
41
|
|
|
* an array with a FQCN and an object manager different from the one specified above: |
42
|
|
|
* 'MyMapperService' => [ |
43
|
|
|
* 'class' => SomeMongoDataMapper::class, |
44
|
|
|
* 'object_manager' => 'Doctrine\ODM\DocumentManager' |
45
|
|
|
* ] |
46
|
|
|
*/ |
47
|
3 |
|
], |
48
|
3 |
|
], |
49
|
3 |
|
], |
50
|
|
|
|
51
|
|
|
/* |
52
|
|
|
* Doctrine ORM mappings for Thorr\Persistence\Entity\AbstractEntity |
53
|
|
|
*/ |
54
|
|
|
'doctrine' => [ |
55
|
|
|
'driver' => [ |
56
|
|
|
'thorr_persistence_doctrine_orm' => [ |
57
|
3 |
|
'class' => 'Doctrine\ORM\Mapping\Driver\XmlDriver', |
58
|
3 |
|
'paths' => __DIR__ . '/../config', |
59
|
3 |
|
], |
60
|
|
|
'orm_default' => [ |
61
|
|
|
'drivers' => [ |
62
|
3 |
|
'Thorr\Persistence\Entity' => 'thorr_persistence_doctrine_orm', |
63
|
3 |
|
], |
64
|
3 |
|
], |
65
|
3 |
|
], |
66
|
3 |
|
], |
67
|
3 |
|
]; |
68
|
|
|
} |
69
|
|
|
|
70
|
1 |
|
public function getDataMapperManagerConfig() |
71
|
|
|
{ |
72
|
|
|
return [ |
73
|
|
|
'abstract_factories' => [ |
74
|
1 |
|
DataMapper\Manager\DoctrineAdapterAbstractFactory::class, |
75
|
1 |
|
], |
76
|
1 |
|
]; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|