@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | /** |
| 191 | 191 | * @param $className |
| 192 | 192 | * |
| 193 | - * @return bool |
|
| 193 | + * @return boolean|string |
|
| 194 | 194 | */ |
| 195 | 195 | public function hasDiscriminatorValue($className) |
| 196 | 196 | { |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * |
| 227 | 227 | * @param $className |
| 228 | 228 | * |
| 229 | - * @return bool|string |
|
| 229 | + * @return false|string |
|
| 230 | 230 | */ |
| 231 | 231 | public function buildDiscriminatorValueMap($className) |
| 232 | 232 | { |
@@ -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; |
@@ -44,14 +44,14 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @var array |
| 46 | 46 | */ |
| 47 | - protected $entityManagerAllClassNames = []; |
|
| 47 | + protected $entityManagerAllClassNames = [ ]; |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Ключем является имя класса, а значением discriminatorValue, взятое из методанных |
| 51 | 51 | * |
| 52 | 52 | * @var array |
| 53 | 53 | */ |
| 54 | - protected $discriminatorValueMap = []; |
|
| 54 | + protected $discriminatorValueMap = [ ]; |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * DiscriminatorEntryListener constructor. |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | protected function init() |
| 88 | 88 | { |
| 89 | 89 | try { |
| 90 | - AnnotationRegistry::registerLoader(function ($class) { |
|
| 90 | + AnnotationRegistry::registerLoader(function($class) { |
|
| 91 | 91 | return (bool) class_exists($class); |
| 92 | 92 | }); |
| 93 | 93 | } catch (\Exception $e) { |
@@ -134,14 +134,14 @@ discard block |
||
| 134 | 134 | * @throws Exception\DuplicateDiscriminatorMapEntryException |
| 135 | 135 | * @throws \Doctrine\ORM\Mapping\MappingException |
| 136 | 136 | */ |
| 137 | - public function buildDiscriminatorMapRootEntity(ClassMetadataInfo $classMetadata, array $allClassNames = []) |
|
| 137 | + public function buildDiscriminatorMapRootEntity(ClassMetadataInfo $classMetadata, array $allClassNames = [ ]) |
|
| 138 | 138 | { |
| 139 | 139 | foreach ($allClassNames as $className) { |
| 140 | 140 | if (is_subclass_of($className, $classMetadata->name) && $this->hasDiscriminatorValue($className)) { |
| 141 | 141 | $discriminatorValue = $this->getDiscriminatorValue($className); |
| 142 | 142 | |
| 143 | 143 | if (array_key_exists($discriminatorValue, $classMetadata->discriminatorMap)) { |
| 144 | - $errMsg = sprintf('Found duplicate discriminator map entry \'%s\' in %s', $discriminatorValue, $className); |
|
| 144 | + $errMsg = sprintf('Found duplicate discriminator map entry \'%s\' in %s', $discriminatorValue, $className); |
|
| 145 | 145 | throw new Exception\DuplicateDiscriminatorMapEntryException($errMsg); |
| 146 | 146 | } |
| 147 | 147 | $classMetadata->addDiscriminatorMapClass($discriminatorValue, $className); |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | { |
| 180 | 180 | $hash = spl_object_hash($em); |
| 181 | 181 | if (array_key_exists($hash, $this->entityManagerAllClassNames)) { |
| 182 | - return $this->entityManagerAllClassNames[$hash]; |
|
| 182 | + return $this->entityManagerAllClassNames[ $hash ]; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $this->entityManagerAllClassNames[$hash] = $em->getConfiguration()->getMetadataDriverImpl()->getAllClassNames(); |
|
| 185 | + $this->entityManagerAllClassNames[ $hash ] = $em->getConfiguration()->getMetadataDriverImpl()->getAllClassNames(); |
|
| 186 | 186 | |
| 187 | - return $this->entityManagerAllClassNames[$hash]; |
|
| 187 | + return $this->entityManagerAllClassNames[ $hash ]; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | public function hasDiscriminatorValue($className) |
| 196 | 196 | { |
| 197 | 197 | if (array_key_exists($className, $this->discriminatorValueMap)) { |
| 198 | - return false !== $this->discriminatorValueMap[$className]; |
|
| 198 | + return false !== $this->discriminatorValueMap[ $className ]; |
|
| 199 | 199 | } |
| 200 | - $this->discriminatorValueMap[$className] = $this->buildDiscriminatorValueMap($className); |
|
| 200 | + $this->discriminatorValueMap[ $className ] = $this->buildDiscriminatorValueMap($className); |
|
| 201 | 201 | |
| 202 | - return $this->discriminatorValueMap[$className]; |
|
| 202 | + return $this->discriminatorValueMap[ $className ]; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | throw new Exception\DiscriminatorValueNotFoundException($errMsg); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - return $this->discriminatorValueMap[$className]; |
|
| 221 | + return $this->discriminatorValueMap[ $className ]; |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |