@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @link https://github.com/nnx-framework/doctrine |
|
4 | - * @author Malofeykin Andrey <[email protected]> |
|
5 | - */ |
|
3 | + * @link https://github.com/nnx-framework/doctrine |
|
4 | + * @author Malofeykin Andrey <[email protected]> |
|
5 | + */ |
|
6 | 6 | namespace Nnx\Doctrine; |
7 | 7 | |
8 | 8 | use Nnx\Doctrine\ObjectManager\DoctrineObjectManager; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @var array |
25 | 25 | */ |
26 | - protected $prototype = []; |
|
26 | + protected $prototype = [ ]; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * @inheritdoc |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) |
40 | 40 | { |
41 | 41 | if (array_key_exists($requestedName, $this->prototype)) { |
42 | - return false !== $this->prototype[$requestedName]; |
|
42 | + return false !== $this->prototype[ $requestedName ]; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $appServiceLocator = $serviceLocator; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $hasOrmEntity = $ormEntityLocator->has($requestedName); |
54 | 54 | if (false === $hasOrmEntity) { |
55 | - $this->prototype[$requestedName] = false; |
|
55 | + $this->prototype[ $requestedName ] = false; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | return $hasOrmEntity; |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) |
76 | 76 | { |
77 | 77 | if (array_key_exists($requestedName, $this->prototype)) { |
78 | - if (!is_object($this->prototype[$requestedName])) { |
|
78 | + if (!is_object($this->prototype[ $requestedName ])) { |
|
79 | 79 | $errMsg = sprintf('Invalid prototype for %s', $requestedName); |
80 | 80 | throw new Exception\RuntimeException($errMsg); |
81 | 81 | } |
82 | - return clone $this->prototype[$requestedName]; |
|
82 | + return clone $this->prototype[ $requestedName ]; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | $appServiceLocator = $serviceLocator; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $r = new ReflectionClass($entityClassName); |
99 | 99 | $entity = $r->newInstance(); |
100 | 100 | } |
101 | - $this->prototype[$requestedName] = $entity; |
|
101 | + $this->prototype[ $requestedName ] = $entity; |
|
102 | 102 | |
103 | 103 | |
104 | 104 | return $entity; |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @link https://github.com/nnx-framework/doctrine |
|
4 | - * @author Malofeykin Andrey <[email protected]> |
|
5 | - */ |
|
3 | + * @link https://github.com/nnx-framework/doctrine |
|
4 | + * @author Malofeykin Andrey <[email protected]> |
|
5 | + */ |
|
6 | 6 | namespace Nnx\Doctrine; |
7 | 7 | |
8 | 8 | use Nnx\Doctrine\ObjectManager\DoctrineObjectManager; |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @link https://github.com/nnx-framework/doctrine |
|
4 | - * @author Malofeykin Andrey <[email protected]> |
|
5 | - */ |
|
3 | + * @link https://github.com/nnx-framework/doctrine |
|
4 | + * @author Malofeykin Andrey <[email protected]> |
|
5 | + */ |
|
6 | 6 | namespace Nnx\Doctrine; |
7 | 7 | |
8 | 8 | use Nnx\Doctrine\ObjectManager\DoctrineObjectManager; |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @link https://github.com/nnx-framework/doctrine |
|
4 | - * @author Malofeykin Andrey <[email protected]> |
|
5 | - */ |
|
3 | + * @link https://github.com/nnx-framework/doctrine |
|
4 | + * @author Malofeykin Andrey <[email protected]> |
|
5 | + */ |
|
6 | 6 | namespace Nnx\Doctrine; |
7 | 7 | |
8 | 8 | use Nnx\Doctrine\ObjectManager\DoctrineObjectManager; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @var array |
30 | 30 | */ |
31 | - protected $doctrineConfig = []; |
|
31 | + protected $doctrineConfig = [ ]; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Ключем является имя ObjectManager'a значением либо массив содержащий имена неймспейсов в которых расположены |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @var array |
39 | 39 | */ |
40 | - protected $namespacesByObjectManagerCache = []; |
|
40 | + protected $namespacesByObjectManagerCache = [ ]; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Опции модуля |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param array $doctrineConfig |
60 | 60 | * @param ModuleOptionsInterface $moduleOptions |
61 | 61 | */ |
62 | - public function __construct(array $doctrineConfig = [], ModuleOptionsInterface $moduleOptions) |
|
62 | + public function __construct(array $doctrineConfig = [ ], ModuleOptionsInterface $moduleOptions) |
|
63 | 63 | { |
64 | 64 | $this->setDoctrineConfig($doctrineConfig); |
65 | 65 | $this->setModuleOptions($moduleOptions); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return $this |
85 | 85 | */ |
86 | - public function setDoctrineConfig(array $doctrineConfig = []) |
|
86 | + public function setDoctrineConfig(array $doctrineConfig = [ ]) |
|
87 | 87 | { |
88 | 88 | $this->doctrineConfig = $doctrineConfig; |
89 | 89 | |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | if (!$this->isValidDoctrineOrmModuleEntityManagerConfig()) { |
105 | - $this->listObjectManagerName = []; |
|
105 | + $this->listObjectManagerName = [ ]; |
|
106 | 106 | return $this->listObjectManagerName; |
107 | 107 | } |
108 | 108 | |
109 | 109 | $doctrineConfig = $this->getDoctrineConfig(); |
110 | 110 | |
111 | - $listObjectManagerName = array_keys($doctrineConfig['entitymanager']); |
|
112 | - $prepareListObjectManagerName = array_map(function ($objectManagerName) { |
|
111 | + $listObjectManagerName = array_keys($doctrineConfig[ 'entitymanager' ]); |
|
112 | + $prepareListObjectManagerName = array_map(function($objectManagerName) { |
|
113 | 113 | return 'doctrine.entitymanager.' . $objectManagerName; |
114 | 114 | }, $listObjectManagerName); |
115 | 115 | |
@@ -128,16 +128,16 @@ discard block |
||
128 | 128 | public function hasNamespacesByObjectManager($objectManagerServiceName) |
129 | 129 | { |
130 | 130 | if (array_key_exists($objectManagerServiceName, $this->namespacesByObjectManagerCache)) { |
131 | - return false !== $this->namespacesByObjectManagerCache[$objectManagerServiceName]; |
|
131 | + return false !== $this->namespacesByObjectManagerCache[ $objectManagerServiceName ]; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | if (!$this->isValidDoctrineOrmModuleConfig()) { |
135 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
135 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
136 | 136 | return false; |
137 | 137 | } |
138 | 138 | |
139 | 139 | if (0 !== strpos($objectManagerServiceName, static::DOCTRINE_PREFIX)) { |
140 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
140 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
141 | 141 | return false; |
142 | 142 | } |
143 | 143 | |
@@ -145,49 +145,49 @@ discard block |
||
145 | 145 | |
146 | 146 | $doctrineConfig = $this->getDoctrineConfig(); |
147 | 147 | |
148 | - if (!array_key_exists($objectManagerName, $doctrineConfig['entitymanager'])) { |
|
149 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
148 | + if (!array_key_exists($objectManagerName, $doctrineConfig[ 'entitymanager' ])) { |
|
149 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | |
153 | - $omConfig = $doctrineConfig['entitymanager'][$objectManagerName]; |
|
153 | + $omConfig = $doctrineConfig[ 'entitymanager' ][ $objectManagerName ]; |
|
154 | 154 | |
155 | - if (!is_array($omConfig) || !array_key_exists('configuration', $omConfig) || !is_string($omConfig['configuration'])) { |
|
156 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
155 | + if (!is_array($omConfig) || !array_key_exists('configuration', $omConfig) || !is_string($omConfig[ 'configuration' ])) { |
|
156 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | |
160 | - $confName = $omConfig['configuration']; |
|
160 | + $confName = $omConfig[ 'configuration' ]; |
|
161 | 161 | |
162 | - if (!array_key_exists($confName, $doctrineConfig['configuration']) || !is_array($doctrineConfig['configuration'][$confName])) { |
|
163 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
162 | + if (!array_key_exists($confName, $doctrineConfig[ 'configuration' ]) || !is_array($doctrineConfig[ 'configuration' ][ $confName ])) { |
|
163 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
164 | 164 | return false; |
165 | 165 | } |
166 | 166 | |
167 | - $omConfiguration = $doctrineConfig['configuration'][$confName]; |
|
167 | + $omConfiguration = $doctrineConfig[ 'configuration' ][ $confName ]; |
|
168 | 168 | |
169 | - if (!array_key_exists('driver', $omConfiguration) || !is_string($omConfiguration['driver'])) { |
|
170 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
169 | + if (!array_key_exists('driver', $omConfiguration) || !is_string($omConfiguration[ 'driver' ])) { |
|
170 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | |
174 | - $driverName = $omConfiguration['driver']; |
|
174 | + $driverName = $omConfiguration[ 'driver' ]; |
|
175 | 175 | |
176 | - if (!array_key_exists($driverName, $doctrineConfig['driver']) || !is_array($doctrineConfig['driver'][$driverName])) { |
|
177 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
176 | + if (!array_key_exists($driverName, $doctrineConfig[ 'driver' ]) || !is_array($doctrineConfig[ 'driver' ][ $driverName ])) { |
|
177 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | |
181 | - $driverConfig = $doctrineConfig['driver'][$driverName]; |
|
181 | + $driverConfig = $doctrineConfig[ 'driver' ][ $driverName ]; |
|
182 | 182 | |
183 | - if (!array_key_exists('drivers', $driverConfig) || !is_array($driverConfig['drivers'])) { |
|
184 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = false; |
|
183 | + if (!array_key_exists('drivers', $driverConfig) || !is_array($driverConfig[ 'drivers' ])) { |
|
184 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = false; |
|
185 | 185 | return false; |
186 | 186 | } |
187 | 187 | |
188 | - $this->namespacesByObjectManagerCache[$objectManagerServiceName] = $this->buildIndexNamespaces($driverConfig['drivers']); |
|
188 | + $this->namespacesByObjectManagerCache[ $objectManagerServiceName ] = $this->buildIndexNamespaces($driverConfig[ 'drivers' ]); |
|
189 | 189 | |
190 | - return false !== $this->namespacesByObjectManagerCache[$objectManagerServiceName]; |
|
190 | + return false !== $this->namespacesByObjectManagerCache[ $objectManagerServiceName ]; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $moduleOptions = $this->getModuleOptions(); |
207 | 207 | $entitySeparator = $moduleOptions->getEntitySeparator(); |
208 | 208 | |
209 | - $index = []; |
|
209 | + $index = [ ]; |
|
210 | 210 | foreach ($listNamespaces as $currentNamespace) { |
211 | 211 | $prepareNamespace = rtrim($currentNamespace, '\\'); |
212 | 212 | $normalizeNamespace = $prepareNamespace . '\\'; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $normalizeNamespaceStack = explode($entitySeparator, $normalizeNamespace); |
215 | 215 | |
216 | 216 | $namespacePrefix = array_shift($normalizeNamespaceStack); |
217 | - $index[$currentNamespace] = $namespacePrefix . $entitySeparator; |
|
217 | + $index[ $currentNamespace ] = $namespacePrefix . $entitySeparator; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | return $index; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | throw new Exception\EntityNamespacesNotFoundException($errMsh); |
237 | 237 | } |
238 | 238 | |
239 | - return $this->namespacesByObjectManagerCache[$objectManagerServiceName]; |
|
239 | + return $this->namespacesByObjectManagerCache[ $objectManagerServiceName ]; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -250,8 +250,8 @@ discard block |
||
250 | 250 | $doctrineConfig = $this->getDoctrineConfig(); |
251 | 251 | |
252 | 252 | return $this->isValidDoctrineOrmModuleEntityManagerConfig() |
253 | - && array_key_exists('configuration', $doctrineConfig) && is_array($doctrineConfig['configuration']) |
|
254 | - && array_key_exists('driver', $doctrineConfig) && is_array($doctrineConfig['driver']); |
|
253 | + && array_key_exists('configuration', $doctrineConfig) && is_array($doctrineConfig[ 'configuration' ]) |
|
254 | + && array_key_exists('driver', $doctrineConfig) && is_array($doctrineConfig[ 'driver' ]); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | { |
264 | 264 | $doctrineConfig = $this->getDoctrineConfig(); |
265 | 265 | |
266 | - return array_key_exists('entitymanager', $doctrineConfig) && is_array($doctrineConfig['entitymanager']); |
|
266 | + return array_key_exists('entitymanager', $doctrineConfig) && is_array($doctrineConfig[ 'entitymanager' ]); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @link https://github.com/nnx-framework/doctrine |
|
4 | - * @author Malofeykin Andrey <[email protected]> |
|
5 | - */ |
|
3 | + * @link https://github.com/nnx-framework/doctrine |
|
4 | + * @author Malofeykin Andrey <[email protected]> |
|
5 | + */ |
|
6 | 6 | namespace Nnx\Doctrine; |
7 | 7 | |
8 | 8 | use Nnx\Doctrine\ObjectManager\DoctrineObjectManager; |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @link https://github.com/nnx-framework/doctrine |
|
4 | - * @author Malofeykin Andrey <[email protected]> |
|
5 | - */ |
|
3 | + * @link https://github.com/nnx-framework/doctrine |
|
4 | + * @author Malofeykin Andrey <[email protected]> |
|
5 | + */ |
|
6 | 6 | namespace Nnx\Doctrine; |
7 | 7 | |
8 | 8 | use Nnx\Doctrine\ObjectManager\DoctrineObjectManager; |
@@ -30,7 +30,7 @@ |
||
30 | 30 | { |
31 | 31 | /** @var array $appConfig */ |
32 | 32 | $appConfig = $serviceLocator->get('config'); |
33 | - $doctrineConfig = array_key_exists('doctrine', $appConfig) ? $appConfig['doctrine'] : []; |
|
33 | + $doctrineConfig = array_key_exists('doctrine', $appConfig) ? $appConfig[ 'doctrine' ] : [ ]; |
|
34 | 34 | |
35 | 35 | /** @var ModuleOptionsPluginManagerInterface $moduleOptionsManager */ |
36 | 36 | $moduleOptionsManager = $serviceLocator->get(ModuleOptionsPluginManagerInterface::class); |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @link https://github.com/nnx-framework/doctrine |
|
4 | - * @author Malofeykin Andrey <[email protected]> |
|
5 | - */ |
|
3 | + * @link https://github.com/nnx-framework/doctrine |
|
4 | + * @author Malofeykin Andrey <[email protected]> |
|
5 | + */ |
|
6 | 6 | namespace Nnx\Doctrine; |
7 | 7 | |
8 | 8 | use Nnx\Doctrine\ObjectManager\DoctrineObjectManager; |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @link https://github.com/nnx-framework/doctrine |
|
4 | - * @author Malofeykin Andrey <[email protected]> |
|
5 | - */ |
|
3 | + * @link https://github.com/nnx-framework/doctrine |
|
4 | + * @author Malofeykin Andrey <[email protected]> |
|
5 | + */ |
|
6 | 6 | namespace Nnx\Doctrine; |
7 | 7 | |
8 | 8 | use Nnx\Doctrine\ObjectManager\DoctrineObjectManager; |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @link https://github.com/nnx-framework/doctrine |
|
4 | - * @author Malofeykin Andrey <[email protected]> |
|
5 | - */ |
|
3 | + * @link https://github.com/nnx-framework/doctrine |
|
4 | + * @author Malofeykin Andrey <[email protected]> |
|
5 | + */ |
|
6 | 6 | namespace Nnx\Doctrine; |
7 | 7 | |
8 | 8 | use Nnx\Doctrine\ObjectManager\DoctrineObjectManager; |