public function processCategory(array $entityRowsIn)
    {
        $metadata = $this->metadataPool->getMetadata(CategoryInterface::class);
        $sequenceInfo = $this->sequenceRegistry->retrieve(CategoryInterface::class);

        if (isset($sequenceInfo['sequenceTable'])) {
            $newIds = [];
            $previousVersionId = $this->readEntityVersion->getPreviousVersionId(
                CategoryInterface::class,
                1
            );

            $nextVersionId = $this->readEntityVersion->getNextVersionId(CategoryInterface::class, 1);
            $this->versionManager->setCurrentVersionId($previousVersionId);

            foreach ($entityRowsIn as $key => $row) {
                $entityRowsIn[$key]['created_in'] = $previousVersionId;
                $entityRowsIn[$key]['updated_in'] = $nextVersionId;
                $newIds[]['sequence_value'] = $row['entity_id'];
            }

            try {
                $connection = $this->appResource->getConnectionByName($metadata->getEntityConnectionName());
                $connection->insertMultiple(
                    $this->appResource->getTableName($sequenceInfo['sequenceTable']), $newIds
                );
            } catch (\Exception $e) {
                $this->logger->critical($e->getMessage(), $e->getTrace());
                throw new \Exception('TODO: use correct Exception class' . PHP_EOL . $e->getMessage());
            }

            $this->versionManager->setCurrentVersionId($nextVersionId);
        }

        return $entityRowsIn;
    }
public function processCategory(array $entityRowsIn)
    {
        $metadata = $this->metadataPool->getMetadata(CategoryInterface::class);
        $sequenceInfo = $this->sequenceRegistry->retrieve(CategoryInterface::class);

        if (isset($sequenceInfo['sequenceTable'])) {
            $newIds = [];
            $previousVersionId = $this->readEntityVersion->getPreviousVersionId(
                CategoryInterface::class,
                1
            );

            $nextVersionId = $this->readEntityVersion->getNextVersionId(CategoryInterface::class, 1);
            $this->versionManager->setCurrentVersionId($previousVersionId);

            foreach ($entityRowsIn as $key => $row) {
                $entityRowsIn[$key]['created_in'] = $previousVersionId;
                $entityRowsIn[$key]['updated_in'] = $nextVersionId;
                $newIds[]['sequence_value'] = $row['entity_id'];
            }

            try {
                $connection = $this->appResource->getConnectionByName($metadata->getEntityConnectionName());
                $connection->insertMultiple(
                    $this->appResource->getTableName($sequenceInfo['sequenceTable']), $newIds
                );
            } catch (\Exception $e) {
                $this->logger->critical($e->getMessage(), $e->getTrace());
                throw new \Exception('TODO: use correct Exception class' . PHP_EOL . $e->getMessage());
            }

            $this->versionManager->setCurrentVersionId($nextVersionId);
        }

        return $entityRowsIn;
    }
public function processCategory ( array $ entityRowsIn ) { $ metadata = $ this -> metadataPool -> getMetadata ( CategoryInterface :: class ) ; $ sequenceInfo = $ this -> sequenceRegistry -> retrieve ( CategoryInterface :: class ) ; if ( isset ( $ sequenceInfo [ 'sequenceTable' ] ) ) { $ newIds = [ ] ; $ previousVersionId = $ this -> readEntityVersion -> getPreviousVersionId ( CategoryInterface :: class , 1 ) ; $ nextVersionId = $ this -> readEntityVersion -> getNextVersionId ( CategoryInterface :: class , 1 ) ; $ this -> versionManager -> setCurrentVersionId ( $ previousVersionId ) ; foreach ( $ entityRowsIn as $ key => $ row ) { $ entityRowsIn [ $ key ] [ 'created_in' ] = $ previousVersionId ; $ entityRowsIn [ $ key ] [ 'updated_in' ] = $ nextVersionId ; $ newIds [ ] [ 'sequence_value' ] = $ row [ 'entity_id' ] ; } try { $ connection = $ this -> appResource -> getConnectionByName ( $ metadata -> getEntityConnectionName ( ) ) ; $ connection -> insertMultiple ( $ this -> appResource -> getTableName ( $ sequenceInfo [ 'sequenceTable' ] ) , $ newIds ) ; } catch ( \ Exception $ e ) { $ this -> logger -> critical ( $ e -> getMessage ( ) , $ e -> getTrace ( ) ) ; throw new \ Exception ( 'TODO: use correct Exception class' . PHP_EOL . $ e -> getMessage ( ) ) ; } $ this -> versionManager -> setCurrentVersionId ( $ nextVersionId ) ; } return $ entityRowsIn ; }
Processes the Entity

@param array $entityRowsIn
@return array

@throws \Exception
Processes the Entity