@@ -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; |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | |
78 | 78 | $listEntityInterfaces = $this->buildListEntityInterfaces($entityClassNames); |
79 | 79 | |
80 | - $map = []; |
|
80 | + $map = [ ]; |
|
81 | 81 | |
82 | 82 | $entityManager = $this->getEntityManager(); |
83 | 83 | foreach ($listEntityInterfaces as $currentInterface) { |
84 | 84 | if ($entityManager->hasEntityClassByInterface($currentInterface)) { |
85 | - $map[$currentInterface] = $entityManager->getEntityClassByInterface($currentInterface); |
|
85 | + $map[ $currentInterface ] = $entityManager->getEntityClassByInterface($currentInterface); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return array |
98 | 98 | */ |
99 | - public function buildListEntityInterfaces(array $entityClassNames = []) |
|
99 | + public function buildListEntityInterfaces(array $entityClassNames = [ ]) |
|
100 | 100 | { |
101 | - $listEntityInterfaces = []; |
|
101 | + $listEntityInterfaces = [ ]; |
|
102 | 102 | |
103 | 103 | $moduleOptionsManager = $this->getModuleOptionsPluginManager(); |
104 | 104 | $allowedModules = $this->getAllowedModules($entityClassNames); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | if ($moduleOptionsManager->hasModuleNameByClassName($currentInterface)) { |
111 | 111 | $moduleNameByInterface = $moduleOptionsManager->getModuleNameByClassName($currentInterface); |
112 | 112 | if (array_key_exists($moduleNameByInterface, $allowedModules)) { |
113 | - $listEntityInterfaces[$currentInterface] = $currentInterface; |
|
113 | + $listEntityInterfaces[ $currentInterface ] = $currentInterface; |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return array |
128 | 128 | */ |
129 | - public function getAllowedModules(array $entityClassNames = []) |
|
129 | + public function getAllowedModules(array $entityClassNames = [ ]) |
|
130 | 130 | { |
131 | 131 | $moduleOptionsManager = $this->getModuleOptionsPluginManager(); |
132 | - $allowedModules = []; |
|
132 | + $allowedModules = [ ]; |
|
133 | 133 | foreach ($entityClassNames as $entityClassName) { |
134 | 134 | if ($moduleOptionsManager->hasModuleNameByClassName($entityClassName)) { |
135 | 135 | $moduleName = $moduleOptionsManager->getModuleNameByClassName($entityClassName); |
136 | - $allowedModules[$moduleName] = $moduleName; |
|
136 | + $allowedModules[ $moduleName ] = $moduleName; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | |
158 | 158 | $allMetadata = $objectManager->getMetadataFactory()->getAllMetadata(); |
159 | 159 | |
160 | - $entityClassNames = []; |
|
160 | + $entityClassNames = [ ]; |
|
161 | 161 | foreach ($allMetadata as $classMetadata) { |
162 | 162 | if ($classMetadata instanceof ClassMetadata) { |
163 | 163 | $entityClassName = $classMetadata->getName(); |
164 | - $entityClassNames[$entityClassName] = $entityClassName; |
|
164 | + $entityClassNames[ $entityClassName ] = $entityClassName; |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 |
@@ -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; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @var array |
43 | 43 | */ |
44 | - protected $cacheKeys = []; |
|
44 | + protected $cacheKeys = [ ]; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * EntityMapCache constructor. |
@@ -124,15 +124,15 @@ discard block |
||
124 | 124 | public function getCacheKeyForObjectManagerName($objectManagerName) |
125 | 125 | { |
126 | 126 | if (array_key_exists($objectManagerName, $this->cacheKeys)) { |
127 | - return $this->cacheKeys[$objectManagerName]; |
|
127 | + return $this->cacheKeys[ $objectManagerName ]; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $preffix = $this->getModuleOptions()->getEntityMapDoctrineCachePrefix(); |
131 | 131 | $key = $preffix . '_' . $objectManagerName; |
132 | 132 | |
133 | - $this->cacheKeys[$objectManagerName] = $key; |
|
133 | + $this->cacheKeys[ $objectManagerName ] = $key; |
|
134 | 134 | |
135 | - return $this->cacheKeys[$objectManagerName]; |
|
135 | + return $this->cacheKeys[ $objectManagerName ]; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -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; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @var array |
28 | 28 | */ |
29 | - protected $prototype = []; |
|
29 | + protected $prototype = [ ]; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Флаг определяет была ли инициированна фабрика |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @var array |
49 | 49 | */ |
50 | - protected $objectManagerToEntityMap = []; |
|
50 | + protected $objectManagerToEntityMap = [ ]; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Колличество ObjectManagers для которых есть EntityMap |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @var array |
63 | 63 | */ |
64 | - protected $baseEntityMap = []; |
|
64 | + protected $baseEntityMap = [ ]; |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Ключем является имя интерфейса, а значением имя класса сущности |
68 | 68 | * |
69 | 69 | * @var array |
70 | 70 | */ |
71 | - protected $interfaceNameToClassName = []; |
|
71 | + protected $interfaceNameToClassName = [ ]; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @inheritdoc |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | $this->init($serviceLocator); |
87 | 87 | if (array_key_exists($requestedName, $this->prototype)) { |
88 | - return false !== $this->prototype[$requestedName]; |
|
88 | + return false !== $this->prototype[ $requestedName ]; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return false !== $this->getClassNameByInterface($requestedName); |
@@ -101,25 +101,25 @@ discard block |
||
101 | 101 | protected function getClassNameByInterface($interfaceName) |
102 | 102 | { |
103 | 103 | if (array_key_exists($interfaceName, $this->interfaceNameToClassName)) { |
104 | - return $this->interfaceNameToClassName[$interfaceName]; |
|
104 | + return $this->interfaceNameToClassName[ $interfaceName ]; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | if (0 === $this->countObjectManagers) { |
108 | - $this->interfaceNameToClassName[$interfaceName] = false; |
|
108 | + $this->interfaceNameToClassName[ $interfaceName ] = false; |
|
109 | 109 | return false; |
110 | 110 | } elseif (1 === $this->countObjectManagers) { |
111 | - $this->interfaceNameToClassName[$interfaceName] = array_key_exists($interfaceName, $this->baseEntityMap) ? $this->baseEntityMap[$interfaceName] : false; |
|
112 | - return $this->interfaceNameToClassName[$interfaceName]; |
|
111 | + $this->interfaceNameToClassName[ $interfaceName ] = array_key_exists($interfaceName, $this->baseEntityMap) ? $this->baseEntityMap[ $interfaceName ] : false; |
|
112 | + return $this->interfaceNameToClassName[ $interfaceName ]; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | foreach ($this->objectManagerToEntityMap as $entityMap) { |
116 | 116 | if (array_key_exists($interfaceName, $entityMap)) { |
117 | - $this->interfaceNameToClassName[$interfaceName] = $entityMap[$interfaceName]; |
|
118 | - return $this->interfaceNameToClassName[$interfaceName]; |
|
117 | + $this->interfaceNameToClassName[ $interfaceName ] = $entityMap[ $interfaceName ]; |
|
118 | + return $this->interfaceNameToClassName[ $interfaceName ]; |
|
119 | 119 | } |
120 | 120 | } |
121 | - $this->interfaceNameToClassName[$interfaceName] = false; |
|
122 | - return $this->interfaceNameToClassName[$interfaceName]; |
|
121 | + $this->interfaceNameToClassName[ $interfaceName ] = false; |
|
122 | + return $this->interfaceNameToClassName[ $interfaceName ]; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $this->init($serviceLocator); |
140 | 140 | |
141 | 141 | if (array_key_exists($requestedName, $this->prototype)) { |
142 | - if (!is_object($this->prototype[$requestedName])) { |
|
142 | + if (!is_object($this->prototype[ $requestedName ])) { |
|
143 | 143 | $errMsg = sprintf('Invalid prototype for %s', $requestedName); |
144 | 144 | throw new Exception\RuntimeException($errMsg); |
145 | 145 | } |
146 | - return clone $this->prototype[$requestedName]; |
|
146 | + return clone $this->prototype[ $requestedName ]; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | $className = $this->getClassNameByInterface($requestedName); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $r = new ReflectionClass($className); |
159 | 159 | $entity = $r->newInstance(); |
160 | 160 | } |
161 | - $this->prototype[$requestedName] = $entity; |
|
161 | + $this->prototype[ $requestedName ] = $entity; |
|
162 | 162 | |
163 | 163 | return $entity; |
164 | 164 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $entityMapCache = $appServiceLocator->get(EntityMapCacheInterface::class); |
197 | 197 | foreach ($listObjectManagerName as $objectManagerName) { |
198 | 198 | if ($entityMapCache->hasEntityMap($objectManagerName)) { |
199 | - $this->objectManagerToEntityMap[$objectManagerName] = $entityMapCache->loadEntityMap($objectManagerName); |
|
199 | + $this->objectManagerToEntityMap[ $objectManagerName ] = $entityMapCache->loadEntityMap($objectManagerName); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 |
@@ -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; |