{@inheritdoc}

@api

@param \Generated\Shared\Transfer\DataImporterConfigurationTransfer|null $dataImporterConfigurationTransfer

@return \Generated\Shared\Transfer\DataImporterReportTransfer
769800
public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()
            ->getProductAlternativeDataImport()
            ->import($dataImporterConfigurationTransfer);
    }
1177292
public function transformToResourceObject(ResourceTransformation $transformation, DataInterface $data): ?array
    {
        if ($transformation->object === null || $transformation->resource === null) {
            return null;
        }

        $transformation->resource->initializeTransformation(
            $transformation->request,
            $transformation->object,
            $transformation->exceptionFactory
        );

        $this->transformResourceIdentifier($transformation);
        $this->transformLinksObject($transformation);
        $this->transformAttributesObject($transformation);
        $this->transformRelationshipsObject($transformation, $data);

        $transformation->resource->clearTransformation();

        return $transformation->result;
    }
451872
protected function dataTransferBackup(DNDataTransfer $dataTransfer, DeploynautLogFile $log) {
		$environment = $dataTransfer->Environment();
		$name = $environment->getFullName();

		// Associate a new archive with the transfer.
		// Doesn't retrieve a filepath just yet, need to generate the files first.
		$dataArchive = DNDataArchive::create();
		$dataArchive->Mode = $dataTransfer->Mode;
		$dataArchive->AuthorID = $dataTransfer->AuthorID;
		$dataArchive->OriginalEnvironmentID = $environment->ID;
		$dataArchive->EnvironmentID = $environment->ID;
		$dataArchive->IsBackup = $dataTransfer->IsBackupDataTransfer();

		// Generate directory structure with strict permissions (contains very sensitive data)
		$filepathBase = $dataArchive->generateFilepath($dataTransfer);
		mkdir($filepathBase, 0700, true);

		$databasePath = $filepathBase . DIRECTORY_SEPARATOR . 'database.sql.gz';

		// Backup database
		if(in_array($dataTransfer->Mode, array('all', 'db'))) {
			$log->write(sprintf('Backup of database from "%s" started', $name));
			$command = $this->getCommand('data:getdb', 'db', $environment, array('data_path' => $databasePath), $log);
			$command->run(function($type, $buffer) use($log) {
				$log->write($buffer);
			});
			if(!$command->isSuccessful()) {
				$this->extend('dataTransferFailure', $environment, $log);
				throw new RuntimeException($command->getErrorOutput());
			}
			$log->write(sprintf('Backup of database from "%s" done', $name));
		}

		// Backup assets
		if(in_array($dataTransfer->Mode, array('all', 'assets'))) {
			$log->write(sprintf('Backup of assets from "%s" started', $name));
			$command = $this->getCommand('data:getassets', 'web', $environment, array('data_path' => $filepathBase), $log);
			$command->run(function($type, $buffer) use($log) {
				$log->write($buffer);
			});
			if(!$command->isSuccessful()) {
				$this->extend('dataTransferFailure', $environment, $log);
				throw new RuntimeException($command->getErrorOutput());
			}
			$log->write(sprintf('Backup of assets from "%s" done', $name));
		}

		// ensure the database connection is re-initialised, which is needed if the transfer
		// above took a really long time because the handle to the db may have become invalid.
		global $databaseConfig;
		DB::connect($databaseConfig);

		$log->write('Creating sspak...');

		$sspakFilename = sprintf('%s.sspak', $dataArchive->generateFilename($dataTransfer));
		$sspakFilepath = $filepathBase . DIRECTORY_SEPARATOR . $sspakFilename;

		try {
			$dataArchive->attachFile($sspakFilepath, $dataTransfer);
			$dataArchive->setArchiveFromFiles($filepathBase);
		} catch(Exception $e) {
			$log->write($e->getMessage());
			throw new RuntimeException($e->getMessage());
		}

		// Remove any assets and db files lying around, they're not longer needed as they're now part
		// of the sspak file we just generated. Use --force to avoid errors when files don't exist,
		// e.g. when just an assets backup has been requested and no database.sql exists.
		$process = new Process(sprintf('rm -rf %s/assets && rm -f %s', escapeshellarg($filepathBase), escapeshellarg($databasePath)));
		$process->setTimeout(120);
		$process->run();
		if(!$process->isSuccessful()) {
			$log->write('Could not delete temporary files');
			throw new RuntimeException($process->getErrorOutput());
		}

		$log->write(sprintf('Creating sspak file done: %s', $dataArchive->ArchiveFile()->getAbsoluteURL()));
	}
829244
public function setStockTransfer(\Flowcode\ShopBundle\Entity\StockTransfer $stockTransfer = null)
    {
        $this->stockTransfer = $stockTransfer;

        return $this;
    }
724574
public function export($dataSetConfig = null)
    {
        $export = [
            'label' => $this->getLabel(),
            'data'  => [],
        ];

        foreach ($this->getData() as $data) {
            $export['data'][] = $data->export();
        }

        if (null !== $dataSetConfig) {
            $export = array_merge($export, $dataSetConfig->export());
        }

        return $export;
    }
596589
public function update(RestCompaniesRequestTransfer $restCompaniesRequestTransfer): RestCompaniesResponseTransfer
    {
        $companyTransfer = $this->companiesRestApiRepository
            ->findCompanyByExternalReference($restCompaniesRequestTransfer->getId());

        if ($companyTransfer === null) {
            return $this->createCompanyFailedToLoadErrorResponseTransfer();
        }

        foreach ($this->companyMapperPlugins as $companyMapperPlugin) {
            $companyTransfer = $companyMapperPlugin->map(
                $restCompaniesRequestTransfer->getRestCompaniesRequestAttributes(),
                $companyTransfer
            );
        }

        try {
            $companyResponseTransfer = $this->companyFacade->update($companyTransfer);
        } catch (PropelException $e) {
            return $this->createCompanyDataInvalidErrorResponse();
        }

        if (!$companyResponseTransfer->getIsSuccessful()) {
            return $this->createCompanyDataInvalidErrorResponse();
        }

        return $this->createCompanyResponseTransfer(
            $companyResponseTransfer->getCompanyTransfer()
        );
    }
541839
public function mapToCompany(
        RestCompaniesRequestAttributesTransfer $restCompaniesRequestAttributesTransfer,
        CompanyTransfer $companyTransfer
    ): CompanyTransfer {
        if ($restCompaniesRequestAttributesTransfer->getExternalReference() !== null) {
            $companyTransfer->setExternalReference(
                $restCompaniesRequestAttributesTransfer->getExternalReference()
            );
        }

        if ($restCompaniesRequestAttributesTransfer->getName() !== null) {
            $companyTransfer->setName($restCompaniesRequestAttributesTransfer->getName());
        }

        return $companyTransfer;
    }
1002313
protected function exportDataTablesCallback(DataTablesProviderInterface $dtProvider, DataTablesRepositoryInterface $repository, DataTablesCSVExporterInterface $dtExporter, $windows) {

        $em = $this->getDoctrine()->getManager();

        $stream = fopen("php://output", "w+");

        // Export the columns.
        fputcsv($stream, DataTablesExportHelper::convert($dtExporter->exportColumns(), $windows), ";");

        // Paginates.
        $total = $repository->dataTablesCountExported($dtProvider);
        $pages = PaginateHelper::getPagesCount($total, DataTablesRepositoryInterface::REPOSITORY_LIMIT);

        // Handle each page.
        for ($i = 0; $i < $pages; ++$i) {

            // Get the offset and limit.
            list($offset, $limit) = PaginateHelper::getPageOffsetAndLimit($i, DataTablesRepositoryInterface::REPOSITORY_LIMIT, $total);

            // Get the export query with offset and limit.
            $result = $repository->dataTablesExportAll($dtProvider)
                ->setFirstResult($offset)
                ->setMaxResults($limit)
                ->getQuery()
                ->iterate();

            while (false !== ($row = $result->next())) {

                $this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_PRE_EXPORT, [$row[0]]);

                fputcsv($stream, DataTablesExportHelper::convert($dtExporter->exportRow($row[0]), $windows), ";");

                // Detach the entity to avoid memory consumption.
                $em->detach($row[0]);

                $this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_POST_EXPORT, [$row[0]]);
            }
        }

        // Close the file.
        fclose($stream);
    }
1275507
public function importShoppingLists(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()
            ->getShoppingListDataImporter()
            ->import($dataImporterConfigurationTransfer);
    }
1258596
public function importProductListProductConcrete(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()
            ->createProductListProductConcreteDataImport()
            ->import($dataImporterConfigurationTransfer);
    }
77273
protected function getNextTransport(): ?TransportInterface
    {
        $cursor = $this->cursor;
        while (true) {
            $transport = $this->transports[$cursor];

            if (!$this->isTransportDead($transport)) {
                break;
            }

            if ((microtime(true) - $this->deadTransports[$transport]) > $this->retryPeriod) {
                $this->deadTransports->detach($transport);

                break;
            }

            if ($this->cursor === $cursor = $this->moveCursor($cursor)) {
                return null;
            }
        }

        $this->cursor = $this->moveCursor($cursor);

        return $transport;
    }
803330
public function setDataProvider(DataProviderInterface $dataProvider = null)
    {
        $this->setData($dataProvider);
        $this->isOperationsApplied = false;
        return $this;
    }
950405
public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createCompanyUnitAddressLabelDataImport()->import($dataImporterConfigurationTransfer);
    }
620517
public function build(ImportConfiguration $importConfiguration, StorageInterface $sourceStorage = null, $createdBy = null, $requestContext = null)
    {
        $importer = $this->importerRepository->get($importConfiguration->getImporterId());
        if ($importer->getSourceStorage()) {
            $sourceStorage = $importer->getSourceStorage();
        } elseif (!$sourceStorage) {
            throw new InvalidConfigurationException("Either the importRequest or the importer '".$importConfiguration->getImporterId()."' must have a source storage set.");
        }

        $importRun = $importConfiguration->toRun($createdBy);

        //apply static context from importer & request
        $context = $requestContext;
        if (!is_null($importer->getContext()) && !empty($importer->getContext())) {
            $importerContext = $importer->getContext();
            if ($importerContext && $requestContext) {
                $context = array_merge($importerContext, $requestContext);
            } else {
                $context = $importerContext;
            }
        }
        $importRun->setContext($context);

        $import = $this->factorImport($importer, $sourceStorage, $importRun);

        //after everthing was build, apply softdata from sourcestorage to importrun
        //dont do this any earlier, as there might be AFTER_BUILD hooks, that may change
        //the sourcestorage configuration
        $importRun->setInfo((array) $sourceStorage->info());

        return $import;
    }
166772
public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createProductDiscontinuedDataImport()->import($dataImporterConfigurationTransfer);
    }
1081646
public function importMerchantRelationshipSalesOrderThresholds(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createMerchantRelationshipSalesOrderThresholdDataImport()->import($dataImporterConfigurationTransfer);
    }
1260408
public function importCompanyRoles(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createCompanyRoleDataImport()->import($dataImporterConfigurationTransfer);
    }