|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace DoctrineModule; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Config provider for DoctrineORMModule config |
|
9
|
|
|
* |
|
10
|
|
|
* @link www.doctrine-project.org |
|
11
|
|
|
*/ |
|
12
|
|
|
class ConfigProvider |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* @return mixed[] |
|
16
|
|
|
*/ |
|
17
|
1 |
|
public function __invoke() : array |
|
18
|
|
|
{ |
|
19
|
|
|
return [ |
|
20
|
1 |
|
'doctrine' => $this->getDoctrineConfig(), |
|
21
|
1 |
|
'doctrine_factories' => $this->getDoctrineFactoryConfig(), |
|
22
|
1 |
|
'dependencies' => $this->getDependencyConfig(), |
|
23
|
1 |
|
'controllers' => $this->getControllerConfig(), |
|
24
|
1 |
|
'route_manager' => $this->getRouteManagerConfig(), |
|
25
|
1 |
|
'console' => $this->getConsoleConfig(), |
|
26
|
1 |
|
'validators' => $this->getValidatorConfig(), |
|
27
|
|
|
]; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Return application-level dependency configuration |
|
32
|
|
|
* |
|
33
|
|
|
* @return mixed[] |
|
34
|
|
|
*/ |
|
35
|
31 |
|
public function getDependencyConfig() : array |
|
36
|
|
|
{ |
|
37
|
|
|
// phpcs:disable Generic.Files.LineLength |
|
38
|
|
|
return [ |
|
39
|
31 |
|
'invokables' => ['DoctrineModule\Authentication\Storage\Session' => 'Laminas\Authentication\Storage\Session'], |
|
40
|
|
|
'factories' => ['doctrine.cli' => 'DoctrineModule\Service\CliFactory'], |
|
41
|
|
|
'abstract_factories' => ['DoctrineModule' => 'DoctrineModule\ServiceFactory\AbstractDoctrineServiceFactory'], |
|
42
|
|
|
]; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
// phpcs:enable Generic.Files.LineLength |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Return controller configuration |
|
49
|
|
|
* |
|
50
|
|
|
* @return mixed[] |
|
51
|
|
|
*/ |
|
52
|
31 |
|
public function getControllerConfig() : array |
|
53
|
|
|
{ |
|
54
|
|
|
return [ |
|
55
|
31 |
|
'factories' => ['DoctrineModule\Controller\Cli' => 'DoctrineModule\Service\CliControllerFactory'], |
|
56
|
|
|
]; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Return route manager configuration |
|
61
|
|
|
* |
|
62
|
|
|
* @return mixed[] |
|
63
|
|
|
*/ |
|
64
|
31 |
|
public function getRouteManagerConfig() : array |
|
65
|
|
|
{ |
|
66
|
|
|
return [ |
|
67
|
31 |
|
'factories' => ['symfony_cli' => 'DoctrineModule\Service\SymfonyCliRouteFactory'], |
|
68
|
|
|
]; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* Return configuration for console routes |
|
73
|
|
|
* |
|
74
|
|
|
* @return mixed[] |
|
75
|
|
|
*/ |
|
76
|
31 |
|
public function getConsoleConfig() : array |
|
77
|
|
|
{ |
|
78
|
|
|
return [ |
|
79
|
31 |
|
'router' => [ |
|
80
|
|
|
'routes' => [ |
|
81
|
|
|
'doctrine_cli' => ['type' => 'symfony_cli'], |
|
82
|
|
|
], |
|
83
|
|
|
], |
|
84
|
|
|
]; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Default configuration for Doctrine module |
|
89
|
|
|
* |
|
90
|
|
|
* @return mixed[] |
|
91
|
|
|
*/ |
|
92
|
31 |
|
public function getDoctrineConfig() : array |
|
93
|
|
|
{ |
|
94
|
|
|
return [ |
|
95
|
31 |
|
'cache' => [ |
|
96
|
|
|
'apc' => [ |
|
97
|
|
|
'class' => 'Doctrine\Common\Cache\ApcCache', |
|
98
|
|
|
'namespace' => 'DoctrineModule', |
|
99
|
|
|
], |
|
100
|
|
|
'apcu' => [ |
|
101
|
|
|
'class' => 'Doctrine\Common\Cache\ApcuCache', |
|
102
|
|
|
'namespace' => 'DoctrineModule', |
|
103
|
|
|
], |
|
104
|
|
|
'array' => [ |
|
105
|
|
|
'class' => 'Doctrine\Common\Cache\ArrayCache', |
|
106
|
|
|
'namespace' => 'DoctrineModule', |
|
107
|
|
|
], |
|
108
|
|
|
'filesystem' => [ |
|
109
|
|
|
'class' => 'Doctrine\Common\Cache\FilesystemCache', |
|
110
|
|
|
'directory' => 'data/DoctrineModule/cache', |
|
111
|
|
|
'namespace' => 'DoctrineModule', |
|
112
|
|
|
], |
|
113
|
|
|
'memcache' => [ |
|
114
|
|
|
'class' => 'Doctrine\Common\Cache\MemcacheCache', |
|
115
|
|
|
'instance' => 'my_memcache_alias', |
|
116
|
|
|
'namespace' => 'DoctrineModule', |
|
117
|
|
|
], |
|
118
|
|
|
'memcached' => [ |
|
119
|
|
|
'class' => 'Doctrine\Common\Cache\MemcachedCache', |
|
120
|
|
|
'instance' => 'my_memcached_alias', |
|
121
|
|
|
'namespace' => 'DoctrineModule', |
|
122
|
|
|
], |
|
123
|
|
|
'predis' => [ |
|
124
|
|
|
'class' => 'Doctrine\Common\Cache\PredisCache', |
|
125
|
|
|
'instance' => 'my_predis_alias', |
|
126
|
|
|
'namespace' => 'DoctrineModule', |
|
127
|
|
|
], |
|
128
|
|
|
'redis' => [ |
|
129
|
|
|
'class' => 'Doctrine\Common\Cache\RedisCache', |
|
130
|
|
|
'instance' => 'my_redis_alias', |
|
131
|
|
|
'namespace' => 'DoctrineModule', |
|
132
|
|
|
], |
|
133
|
|
|
'wincache' => [ |
|
134
|
|
|
'class' => 'Doctrine\Common\Cache\WinCacheCache', |
|
135
|
|
|
'namespace' => 'DoctrineModule', |
|
136
|
|
|
], |
|
137
|
|
|
'xcache' => [ |
|
138
|
|
|
'class' => 'Doctrine\Common\Cache\XcacheCache', |
|
139
|
|
|
'namespace' => 'DoctrineModule', |
|
140
|
|
|
], |
|
141
|
|
|
'zenddata' => [ |
|
142
|
|
|
'class' => 'Doctrine\Common\Cache\ZendDataCache', |
|
143
|
|
|
'namespace' => 'DoctrineModule', |
|
144
|
|
|
], |
|
145
|
|
|
], |
|
146
|
|
|
|
|
147
|
|
|
//These authentication settings are a hack to tide things over until version 1.0 |
|
148
|
|
|
//Normall doctrineModule should have no mention of odm or orm |
|
149
|
|
|
'authentication' => [ |
|
150
|
|
|
//default authentication options should be set in either the odm or orm modules |
|
151
|
|
|
'odm_default' => [], |
|
152
|
|
|
'orm_default' => [], |
|
153
|
|
|
], |
|
154
|
|
|
'authenticationadapter' => [ |
|
155
|
|
|
'odm_default' => true, |
|
156
|
|
|
'orm_default' => true, |
|
157
|
|
|
], |
|
158
|
|
|
'authenticationstorage' => [ |
|
159
|
|
|
'odm_default' => true, |
|
160
|
|
|
'orm_default' => true, |
|
161
|
|
|
], |
|
162
|
|
|
'authenticationservice' => [ |
|
163
|
|
|
'odm_default' => true, |
|
164
|
|
|
'orm_default' => true, |
|
165
|
|
|
], |
|
166
|
|
|
]; |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* Factory mappings - used to define which factory to use to instantiate a particular doctrine service type |
|
171
|
|
|
* |
|
172
|
|
|
* @return mixed[] |
|
173
|
|
|
*/ |
|
174
|
31 |
|
public function getDoctrineFactoryConfig() : array |
|
175
|
|
|
{ |
|
176
|
|
|
return [ |
|
177
|
31 |
|
'cache' => 'DoctrineModule\Service\CacheFactory', |
|
178
|
|
|
'eventmanager' => 'DoctrineModule\Service\EventManagerFactory', |
|
179
|
|
|
'driver' => 'DoctrineModule\Service\DriverFactory', |
|
180
|
|
|
'authenticationadapter' => 'DoctrineModule\Service\Authentication\AdapterFactory', |
|
181
|
|
|
'authenticationstorage' => 'DoctrineModule\Service\Authentication\StorageFactory', |
|
182
|
|
|
'authenticationservice' => 'DoctrineModule\Service\Authentication\AuthenticationServiceFactory', |
|
183
|
|
|
]; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
/** |
|
187
|
|
|
* @return mixed[] |
|
188
|
|
|
*/ |
|
189
|
31 |
|
public function getValidatorConfig() : array |
|
190
|
|
|
{ |
|
191
|
|
|
return [ |
|
192
|
31 |
|
'aliases' => [ |
|
193
|
|
|
'DoctrineNoObjectExists' => Validator\NoObjectExists::class, |
|
194
|
|
|
'DoctrineObjectExists' => Validator\ObjectExists::class, |
|
195
|
|
|
'DoctrineUniqueObject' => Validator\UniqueObject::class, |
|
196
|
|
|
], |
|
197
|
|
|
'factories' => [ |
|
198
|
|
|
Validator\NoObjectExists::class => Validator\Service\NoObjectExistsFactory::class, |
|
199
|
|
|
Validator\ObjectExists::class => Validator\Service\ObjectExistsFactory::class, |
|
200
|
|
|
Validator\UniqueObject::class => Validator\Service\UniqueObjectFactory::class, |
|
201
|
|
|
], |
|
202
|
|
|
]; |
|
203
|
|
|
} |
|
204
|
|
|
} |
|
205
|
|
|
|