1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
4
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
5
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
6
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
7
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
8
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
9
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
10
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
11
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
12
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
13
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
14
|
|
|
* |
15
|
|
|
* This software consists of voluntary contributions made by many individuals |
16
|
|
|
* and is licensed under the MIT license. For more information, see |
17
|
|
|
* <http://www.doctrine-project.org>. |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace DoctrineModule; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Config provider for DoctrineORMModule config |
24
|
|
|
* |
25
|
|
|
* @license MIT |
26
|
|
|
* @link www.doctrine-project.org |
27
|
|
|
* @author James Titcumb <[email protected]> |
28
|
|
|
*/ |
29
|
|
|
class ConfigProvider |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @return array |
33
|
|
|
*/ |
34
|
1 |
|
public function __invoke() |
35
|
|
|
{ |
36
|
|
|
return [ |
37
|
1 |
|
'doctrine' => $this->getDoctrineConfig(), |
38
|
1 |
|
'doctrine_factories' => $this->getDoctrineFactoryConfig(), |
39
|
1 |
|
'dependencies' => $this->getDependencyConfig(), |
40
|
1 |
|
'controllers' => $this->getControllerConfig(), |
41
|
1 |
|
'route_manager' => $this->getRouteManagerConfig(), |
42
|
1 |
|
'console' => $this->getConsoleConfig(), |
43
|
1 |
|
]; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Return application-level dependency configuration |
48
|
|
|
* |
49
|
|
|
* @return array |
50
|
|
|
*/ |
51
|
31 |
|
public function getDependencyConfig() |
52
|
|
|
{ |
53
|
|
|
return [ |
54
|
|
|
'invokables' => [ |
55
|
31 |
|
'DoctrineModule\Authentication\Storage\Session' => 'Zend\Authentication\Storage\Session', |
56
|
31 |
|
], |
57
|
|
|
'factories' => [ |
58
|
31 |
|
'doctrine.cli' => 'DoctrineModule\Service\CliFactory', |
59
|
31 |
|
], |
60
|
|
|
'abstract_factories' => [ |
61
|
31 |
|
'DoctrineModule' => 'DoctrineModule\ServiceFactory\AbstractDoctrineServiceFactory', |
62
|
31 |
|
], |
63
|
31 |
|
]; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Return controller configuration |
68
|
|
|
* |
69
|
|
|
* @return array |
70
|
|
|
*/ |
71
|
31 |
|
public function getControllerConfig() |
72
|
|
|
{ |
73
|
|
|
return [ |
74
|
|
|
'factories' => [ |
75
|
31 |
|
'DoctrineModule\Controller\Cli' => 'DoctrineModule\Service\CliControllerFactory', |
76
|
31 |
|
], |
77
|
31 |
|
]; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Return route manager configuration |
82
|
|
|
* |
83
|
|
|
* @return array |
84
|
|
|
*/ |
85
|
31 |
|
public function getRouteManagerConfig() |
86
|
|
|
{ |
87
|
|
|
return [ |
88
|
|
|
'factories' => [ |
89
|
31 |
|
'symfony_cli' => 'DoctrineModule\Service\SymfonyCliRouteFactory', |
90
|
31 |
|
], |
91
|
31 |
|
]; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Return configuration for console routes |
96
|
|
|
* |
97
|
|
|
* @return array |
98
|
|
|
*/ |
99
|
31 |
|
public function getConsoleConfig() |
100
|
|
|
{ |
101
|
|
|
return [ |
102
|
|
|
'router' => [ |
103
|
|
|
'routes' => [ |
104
|
|
|
'doctrine_cli' => [ |
105
|
31 |
|
'type' => 'symfony_cli', |
106
|
31 |
|
], |
107
|
31 |
|
], |
108
|
31 |
|
], |
109
|
31 |
|
]; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Default configuration for Doctrine module |
114
|
|
|
* |
115
|
|
|
* @return array |
116
|
|
|
*/ |
117
|
31 |
|
public function getDoctrineConfig() |
118
|
|
|
{ |
119
|
|
|
return [ |
120
|
|
|
'cache' => [ |
121
|
|
|
'apc' => [ |
122
|
31 |
|
'class' => 'Doctrine\Common\Cache\ApcCache', |
123
|
31 |
|
'namespace' => 'DoctrineModule', |
124
|
31 |
|
], |
125
|
|
|
'apcu' => [ |
126
|
31 |
|
'class' => 'Doctrine\Common\Cache\ApcuCache', |
127
|
31 |
|
'namespace' => 'DoctrineModule', |
128
|
31 |
|
], |
129
|
|
|
'array' => [ |
130
|
31 |
|
'class' => 'Doctrine\Common\Cache\ArrayCache', |
131
|
31 |
|
'namespace' => 'DoctrineModule', |
132
|
31 |
|
], |
133
|
|
|
'filesystem' => [ |
134
|
31 |
|
'class' => 'Doctrine\Common\Cache\FilesystemCache', |
135
|
31 |
|
'directory' => 'data/DoctrineModule/cache', |
136
|
31 |
|
'namespace' => 'DoctrineModule', |
137
|
31 |
|
], |
138
|
|
|
'memcache' => [ |
139
|
31 |
|
'class' => 'Doctrine\Common\Cache\MemcacheCache', |
140
|
31 |
|
'instance' => 'my_memcache_alias', |
141
|
31 |
|
'namespace' => 'DoctrineModule', |
142
|
31 |
|
], |
143
|
|
|
'memcached' => [ |
144
|
31 |
|
'class' => 'Doctrine\Common\Cache\MemcachedCache', |
145
|
31 |
|
'instance' => 'my_memcached_alias', |
146
|
31 |
|
'namespace' => 'DoctrineModule', |
147
|
31 |
|
], |
148
|
|
|
'predis' => [ |
149
|
31 |
|
'class' => 'Doctrine\Common\Cache\PredisCache', |
150
|
31 |
|
'instance' => 'my_predis_alias', |
151
|
31 |
|
'namespace' => 'DoctrineModule', |
152
|
31 |
|
], |
153
|
|
|
'redis' => [ |
154
|
31 |
|
'class' => 'Doctrine\Common\Cache\RedisCache', |
155
|
31 |
|
'instance' => 'my_redis_alias', |
156
|
31 |
|
'namespace' => 'DoctrineModule', |
157
|
31 |
|
], |
158
|
|
|
'wincache' => [ |
159
|
31 |
|
'class' => 'Doctrine\Common\Cache\WinCacheCache', |
160
|
31 |
|
'namespace' => 'DoctrineModule', |
161
|
31 |
|
], |
162
|
|
|
'xcache' => [ |
163
|
31 |
|
'class' => 'Doctrine\Common\Cache\XcacheCache', |
164
|
31 |
|
'namespace' => 'DoctrineModule', |
165
|
31 |
|
], |
166
|
|
|
'zenddata' => [ |
167
|
31 |
|
'class' => 'Doctrine\Common\Cache\ZendDataCache', |
168
|
31 |
|
'namespace' => 'DoctrineModule', |
169
|
31 |
|
], |
170
|
31 |
|
], |
171
|
|
|
|
172
|
|
|
//These authentication settings are a hack to tide things over until version 1.0 |
173
|
|
|
//Normall doctrineModule should have no mention of odm or orm |
174
|
|
|
'authentication' => [ |
175
|
|
|
//default authentication options should be set in either the odm or orm modules |
176
|
31 |
|
'odm_default' => [], |
177
|
31 |
|
'orm_default' => [], |
178
|
31 |
|
], |
179
|
|
|
'authenticationadapter' => [ |
180
|
31 |
|
'odm_default' => true, |
181
|
31 |
|
'orm_default' => true, |
182
|
31 |
|
], |
183
|
|
|
'authenticationstorage' => [ |
184
|
31 |
|
'odm_default' => true, |
185
|
31 |
|
'orm_default' => true, |
186
|
31 |
|
], |
187
|
|
|
'authenticationservice' => [ |
188
|
31 |
|
'odm_default' => true, |
189
|
31 |
|
'orm_default' => true, |
190
|
31 |
|
], |
191
|
31 |
|
]; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* Factory mappings - used to define which factory to use to instantiate a particular doctrine service type |
196
|
|
|
* |
197
|
|
|
* @return array |
198
|
|
|
*/ |
199
|
31 |
|
public function getDoctrineFactoryConfig() |
200
|
|
|
{ |
201
|
|
|
return [ |
202
|
31 |
|
'cache' => 'DoctrineModule\Service\CacheFactory', |
203
|
31 |
|
'eventmanager' => 'DoctrineModule\Service\EventManagerFactory', |
204
|
31 |
|
'driver' => 'DoctrineModule\Service\DriverFactory', |
205
|
31 |
|
'authenticationadapter' => 'DoctrineModule\Service\Authentication\AdapterFactory', |
206
|
31 |
|
'authenticationstorage' => 'DoctrineModule\Service\Authentication\StorageFactory', |
207
|
31 |
|
'authenticationservice' => 'DoctrineModule\Service\Authentication\AuthenticationServiceFactory', |
208
|
31 |
|
]; |
209
|
|
|
} |
210
|
|
|
} |
211
|
|
|
|