@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | throw new Exception\RuntimeException($errMsg); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $delegateDriver = $serviceLocator->get($creationOptions['delegate']); |
|
| 43 | + $delegateDriver = $serviceLocator->get($creationOptions[ 'delegate' ]); |
|
| 44 | 44 | |
| 45 | 45 | if (!$delegateDriver instanceof DriverInterface) { |
| 46 | 46 | $errMsg = sprintf('Delegate driver not implement %s', DriverInterface::class); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $errMsg = 'Manager registry service name not specified'; |
| 52 | 52 | throw new Exception\RuntimeException($errMsg); |
| 53 | 53 | } |
| 54 | - $managerRegistry = $serviceLocator->get($creationOptions['managerRegistry']); |
|
| 54 | + $managerRegistry = $serviceLocator->get($creationOptions[ 'managerRegistry' ]); |
|
| 55 | 55 | |
| 56 | 56 | if (!$managerRegistry instanceof ManagerRegistry) { |
| 57 | 57 | $errMsg = sprintf( |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @var array |
| 35 | 35 | */ |
| 36 | - protected $dataContainerIdToEntityClassName = []; |
|
| 36 | + protected $dataContainerIdToEntityClassName = [ ]; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * id контейнера с данными, для которого стоит искать уже созданную сущность в базе данных |
| 40 | 40 | * |
| 41 | 41 | * @var array |
| 42 | 42 | */ |
| 43 | - protected $candidatesForSearchInDb = []; |
|
| 43 | + protected $candidatesForSearchInDb = [ ]; |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Ключем является id контейнера с данными, а значением массив со следующей структурой: |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @var array |
| 50 | 50 | */ |
| 51 | - protected $associationMap = []; |
|
| 51 | + protected $associationMap = [ ]; |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Добавляет элемент в карту ассоциаций |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $fromDataItemId = $fromDataItem->getId(); |
| 65 | 65 | if (!array_key_exists($fromDataItemId, $this->associationMap)) { |
| 66 | - $this->associationMap[$fromDataItemId] = []; |
|
| 66 | + $this->associationMap[ $fromDataItemId ] = [ ]; |
|
| 67 | 67 | } |
| 68 | 68 | $associationName = $association->getName(); |
| 69 | - if (!array_key_exists($associationName, $this->associationMap[$fromDataItemId])) { |
|
| 70 | - $this->associationMap[$fromDataItemId][$associationName] = []; |
|
| 69 | + if (!array_key_exists($associationName, $this->associationMap[ $fromDataItemId ])) { |
|
| 70 | + $this->associationMap[ $fromDataItemId ][ $associationName ] = [ ]; |
|
| 71 | 71 | } |
| 72 | 72 | $toDataItemId = $toDataItem->getId(); |
| 73 | - $this->associationMap[$fromDataItemId][$associationName][$toDataItemId] = $toDataItemId; |
|
| 73 | + $this->associationMap[ $fromDataItemId ][ $associationName ][ $toDataItemId ] = $toDataItemId; |
|
| 74 | 74 | |
| 75 | 75 | return $this; |
| 76 | 76 | } |
@@ -88,13 +88,13 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $fromDataItemId = $fromDataItem->getId(); |
| 90 | 90 | if (!array_key_exists($fromDataItemId, $this->associationMap)) { |
| 91 | - $this->associationMap[$fromDataItemId] = []; |
|
| 91 | + $this->associationMap[ $fromDataItemId ] = [ ]; |
|
| 92 | 92 | } |
| 93 | - if (!array_key_exists($associationName, $this->associationMap[$fromDataItemId])) { |
|
| 94 | - $this->associationMap[$fromDataItemId][$associationName] = []; |
|
| 93 | + if (!array_key_exists($associationName, $this->associationMap[ $fromDataItemId ])) { |
|
| 94 | + $this->associationMap[ $fromDataItemId ][ $associationName ] = [ ]; |
|
| 95 | 95 | } |
| 96 | 96 | $toDataItemId = $toDataItem->getId(); |
| 97 | - $this->associationMap[$fromDataItemId][$associationName][$toDataItemId] = $toDataItemId; |
|
| 97 | + $this->associationMap[ $fromDataItemId ][ $associationName ][ $toDataItemId ] = $toDataItemId; |
|
| 98 | 98 | |
| 99 | 99 | return $this; |
| 100 | 100 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function linkDataContainerToEntityClassName(DataContainer\EntityInterface $dataItem, $entityClassName) |
| 111 | 111 | { |
| 112 | - $this->dataContainerIdToEntityClassName[$dataItem->getId()] = $entityClassName; |
|
| 112 | + $this->dataContainerIdToEntityClassName[ $dataItem->getId() ] = $entityClassName; |
|
| 113 | 113 | |
| 114 | 114 | return $this; |
| 115 | 115 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | throw new Exception\RuntimeException($errMsg); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - return $this->dataContainerIdToEntityClassName[$dataItemId]; |
|
| 135 | + return $this->dataContainerIdToEntityClassName[ $dataItemId ]; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | throw new Exception\RuntimeException($errMsg); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - return $this->associationMap[$dataItemId]; |
|
| 155 | + return $this->associationMap[ $dataItemId ]; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @var array |
| 48 | 48 | */ |
| 49 | - private $dataContainerIdToDoctrineEntity = []; |
|
| 49 | + private $dataContainerIdToDoctrineEntity = [ ]; |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Компонет отвечающий за создание сущностей |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | $entityMetadata = $this->objectManager->getClassMetadata($entityClassName); |
| 303 | 303 | |
| 304 | 304 | $identifierFieldNames = $entityMetadata->getIdentifierFieldNames(); |
| 305 | - $idValueList = []; |
|
| 305 | + $idValueList = [ ]; |
|
| 306 | 306 | |
| 307 | 307 | $properties = $dataItem->getProperties(); |
| 308 | 308 | foreach ($identifierFieldNames as $identifierFieldName) { |
@@ -310,8 +310,8 @@ discard block |
||
| 310 | 310 | $errMsg = sprintf('Not find value for property %s from %s', $identifierFieldName, $entityClassName); |
| 311 | 311 | throw new Exception\RuntimeException($errMsg); |
| 312 | 312 | } |
| 313 | - $property = $properties[$identifierFieldName]; |
|
| 314 | - $idValueList[$identifierFieldName] = $property->getValue(); |
|
| 313 | + $property = $properties[ $identifierFieldName ]; |
|
| 314 | + $idValueList[ $identifierFieldName ] = $property->getValue(); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | return $idValueList; |
@@ -332,12 +332,12 @@ discard block |
||
| 332 | 332 | $entityRepository = $this->objectManager->getRepository($entityClassName); |
| 333 | 333 | |
| 334 | 334 | |
| 335 | - $findEntities = []; |
|
| 335 | + $findEntities = [ ]; |
|
| 336 | 336 | if ($this->isFindById($dataItem)) { |
| 337 | 337 | $searchByIdCriteria = $this->buildSearchByIdCriteria($dataItem); |
| 338 | 338 | $entity = $entityRepository->find($searchByIdCriteria); |
| 339 | 339 | if (null !== $entity) { |
| 340 | - $findEntities[] = $entity; |
|
| 340 | + $findEntities[ ] = $entity; |
|
| 341 | 341 | } |
| 342 | 342 | } else { |
| 343 | 343 | $searchCriteria = $this->buildSearchCriteria($dataItem); |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | if (1 === $countFindEntities) { |
| 354 | - $this->dataContainerIdToDoctrineEntity[$dataItem->getId()] = array_pop($findEntities); |
|
| 354 | + $this->dataContainerIdToDoctrineEntity[ $dataItem->getId() ] = array_pop($findEntities); |
|
| 355 | 355 | } else { |
| 356 | 356 | $this->createEntity($dataItem); |
| 357 | 357 | } |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | $this->objectManager->persist($entity); |
| 373 | 373 | |
| 374 | - $this->dataContainerIdToDoctrineEntity[$dataItem->getId()] = $entity; |
|
| 374 | + $this->dataContainerIdToDoctrineEntity[ $dataItem->getId() ] = $entity; |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | /** |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | throw new Exception\RuntimeException($errMsg); |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - return $this->dataContainerIdToDoctrineEntity[$dataItemId]; |
|
| 393 | + return $this->dataContainerIdToDoctrineEntity[ $dataItemId ]; |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | /** |
@@ -402,11 +402,11 @@ discard block |
||
| 402 | 402 | */ |
| 403 | 403 | protected function buildSearchCriteria(DataContainer\EntityInterface $dataItem) |
| 404 | 404 | { |
| 405 | - $searchCriteria = []; |
|
| 405 | + $searchCriteria = [ ]; |
|
| 406 | 406 | |
| 407 | 407 | foreach ($dataItem->getProperties() as $property) { |
| 408 | 408 | $normalizeName = Inflector::camelize($property->getName()); |
| 409 | - $searchCriteria[$normalizeName] = $property->getValue(); |
|
| 409 | + $searchCriteria[ $normalizeName ] = $property->getValue(); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | return $searchCriteria; |