@param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet

@throws \Spryker\Zed\CompanyUnitAddressLabelDataImport\Business\Exception\CompanyUnitAddressLabelNotFoundException

@return void
424406
public function execute(DataSetInterface $dataSet)
    {
        $labelName = $dataSet[CompanyUnitAddressLabelRelationDataSet::LABEL_NAME];
        if (!isset($this->idCompanyUnitAddressLabelCache[$labelName])) {
            $companyUnitAddressLabelQuery = new SpyCompanyUnitAddressLabelQuery();
            $idCompanyUnitAddressLabel = $companyUnitAddressLabelQuery
                ->select(SpyCompanyUnitAddressLabelTableMap::COL_ID_COMPANY_UNIT_ADDRESS_LABEL)
                ->findOneByName($labelName);

            if (!$idCompanyUnitAddressLabel) {
                throw new CompanyUnitAddressLabelNotFoundException(sprintf('Could not find CompanyUnitAddressLabel with name "%s".', $labelName));
            }

            $this->idCompanyUnitAddressLabelCache[$labelName] = $idCompanyUnitAddressLabel;
        }

        $dataSet[CompanyUnitAddressLabelRelationDataSet::ID_COMPANY_UNIT_ADDRESS_LABEL] = $this->idCompanyUnitAddressLabelCache[$labelName];
    }
284653
public function execute(DataSetInterface $dataSet): void
    {
        $companyBusinessUnitKey = $dataSet[MerchantRelationshipDataSetInterface::COMPANY_BUSINESS_UNIT_OWNER_KEY];
        if (!$companyBusinessUnitKey) {
            throw new InvalidDataException('"' . MerchantRelationshipDataSetInterface::COMPANY_BUSINESS_UNIT_OWNER_KEY . '" is required.');
        }

        if (!isset($this->idCompanyBusinessUnitCache[$companyBusinessUnitKey])) {
            $idCompanyBusinessUnit = SpyCompanyBusinessUnitQuery::create()
                ->select(SpyCompanyBusinessUnitTableMap::COL_ID_COMPANY_BUSINESS_UNIT)
                ->findOneByKey($companyBusinessUnitKey);

            if (!$idCompanyBusinessUnit) {
                throw new EntityNotFoundException(sprintf('Could not find Company Business Unit by key "%s"', $companyBusinessUnitKey));
            }

            $this->idCompanyBusinessUnitCache[$companyBusinessUnitKey] = $idCompanyBusinessUnit;
        }

        $dataSet[MerchantRelationshipDataSetInterface::ID_COMPANY_BUSINESS_UNIT] = $this->idCompanyBusinessUnitCache[$companyBusinessUnitKey];
    }
173752
public function execute(DataSetInterface $dataSet)
    {
        $companyEntity = SpyCompanyQuery::create()
            ->filterByKey($dataSet[CompanyDataSet::COMPANY_KEY])
            ->findOneOrCreate();

        $companyEntity->fromArray($dataSet->getArrayCopy());

        $companyEntity->save();
    }
65839
public function execute(DataSetInterface $dataSet): void
    {
        $productListKey = $dataSet[ProductListDataSetInterface::PRODUCT_LIST_KEY];
        if (!$productListKey) {
            throw new InvalidDataException(sprintf('"%s" is required.', ProductListDataSetInterface::PRODUCT_LIST_KEY));
        }

        $dataSet[ProductListDataSetInterface::ID_PRODUCT_LIST] = $this->getIdProductListByKey($productListKey);
    }
525560
protected function buildCacheIndex(DataSetInterface $dataSet): string
    {
        return implode('-', [
            $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_STORE],
            $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_CURRENCY],
            $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRICE_PRODUCT],
            $dataSet[PriceProductMerchantRelationshipDataSetInterface::PRICE_NET],
            $dataSet[PriceProductMerchantRelationshipDataSetInterface::PRICE_GROSS],
        ]);
    }
253570
protected function processDataSet(DataSet $dataSet)
    {
        if ($dataSet->getPattern() === File::HEADER_PATTERN) {
            $this->processHeader($dataSet);
        } else {
            $this->processBrowserData($dataSet);
        }
    }
860328
public function execute(DataSetInterface $dataSet): void
    {
        $idCompany = $this->getIdCompanyByKey($dataSet[CompanyRoleDataSetInterface::COLUMN_COMPANY_KEY]);

        $companyRoleEntity = SpyCompanyRoleQuery::create()
            ->filterByKey($dataSet[CompanyRoleDataSetInterface::COLUMN_COMPANY_ROLE_KEY])
            ->findOneOrCreate();

        $companyRoleEntity
            ->setFkCompany($idCompany)
            ->setName($dataSet[CompanyRoleDataSetInterface::COLUMN_COMPANY_ROLE_NAME])
            ->setIsDefault((bool)$dataSet[CompanyRoleDataSetInterface::COLUMN_IS_DEFAULT])
            ->save();
    }
475157
public function execute(DataSetInterface $dataSet): void
    {
        $idCompanyRole = $this->getIdCompanyRoleByKey($dataSet[CompanyUserRoleDataSetInterface::COLUMN_COMPANY_ROLE_KEY]);
        $idCompanyUser = $this->getIdCompanyUserByKey($dataSet[CompanyUserRoleDataSetInterface::COLUMN_COMPANY_USER_KEY]);

        $companyUserRoleEntity = SpyCompanyRoleToCompanyUserQuery::create()
            ->filterByFkCompanyRole($idCompanyRole)
            ->filterByFkCompanyUser($idCompanyUser)
            ->findOneOrCreate();

        $companyUserRoleEntity->save();
    }
583652
public function partial(Dataset $dataset) : void
    {
        if (!$dataset instanceof Labeled) {
            throw new InvalidArgumentException('This estimator requires a'
                . ' labeled training set.');
        }

        DatasetIsCompatibleWithEstimator::check($dataset, $this);

        $this->classes = array_unique(array_merge($this->classes, $dataset->possibleOutcomes()));
        $this->samples = array_merge($this->samples, $dataset->samples());
        $this->labels = array_merge($this->labels, $dataset->labels());
    }
472720
public function execute(DataSetInterface $dataSet): void
    {
        $storeTransfer = $this->getStoreByName($dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_STORE]);
        $currencyTransfer = $this->getCurrencyByCode($dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_CURRENCY]);
        $merchantRelationshipTransfer = $this->getMerchantRelationshipByKey(
            $dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_MERCHANT_RELATIONSHIP_KEY]
        );

        if ($dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_SALES_ORDER_THRESHOLD_TYPE_KEY] && $dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_THRESHOLD]) {
            $merchantRelationshipSalesOrderThresholdTransfer = $this->createMerchantRelationshipSalesOrderThresholdTransfer(
                $dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_SALES_ORDER_THRESHOLD_TYPE_KEY],
                $merchantRelationshipTransfer,
                $storeTransfer,
                $currencyTransfer,
                (int)$dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_THRESHOLD],
                (int)$dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_FEE],
                $dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_MESSAGE_GLOSSARY_KEY]
            );

            $this->merchantRelationshipSalesOrderThresholdFacade->saveMerchantRelationshipSalesOrderThreshold(
                $merchantRelationshipSalesOrderThresholdTransfer
            );
        }
    }
662742
protected function preparePriceDataKeysCache(DataSetInterface $dataSet): void
    {
        if ($this->isDataKeysCachePrepared) {
            return;
        }
        foreach ($dataSet as $key => $value) {
            if (!$this->isPriceDataKey($key)) {
                continue;
            }
            $this->priceDataKeysCache[$key] = $this->getPriceDataKey($key);
        }
        $this->isDataKeysCachePrepared = true;
    }
51219
public function execute(DataSetInterface $dataSet)
    {
        $categoryEntity = $this->findOrCreateCategory($dataSet);
        $this->findOrCreateAttributes($categoryEntity, $dataSet);
        $categoryNodeEntity = $this->findOrCreateNode($categoryEntity, $dataSet);

        $this->categoryReader->addCategory($categoryEntity, $categoryNodeEntity);
    }
1262051
public function execute(DataSetInterface $dataSet): void
    {
        $categoryKey = $dataSet[ProductListDataSetInterface::CATEGORY_KEY];
        if (!$categoryKey) {
            throw new InvalidDataException(sprintf('"%s" is required.', ProductListDataSetInterface::CATEGORY_KEY));
        }

        $dataSet[ProductListDataSetInterface::ID_CATEGORY] = $this->getIdCategoryByKey($categoryKey);
    }
718008
protected function saveMerchantRelationshipToCompanyBusinessUnit(DataSetInterface $dataSet, int $idMerchantRelationship): void
    {
        SpyMerchantRelationshipToCompanyBusinessUnitQuery::create()
            ->filterByFkMerchantRelationship($idMerchantRelationship)
            ->delete();

        foreach ($dataSet[MerchantRelationshipDataSetInterface::ID_COMPANY_BUSINESS_UNIT_ASSIGNEE_COLLECTION] as $idCompanyBusinessUnit) {
            (new SpyMerchantRelationshipToCompanyBusinessUnit())
                ->setFkMerchantRelationship($idMerchantRelationship)
                ->setFkCompanyBusinessUnit($idCompanyBusinessUnit)
                ->save();
        }
    }
1333742
protected function saveProductListProductConcrete(DataSetInterface $dataSet): void
    {
        $productListProductConcreteEntity = SpyProductListProductConcreteQuery::create()
            ->filterByFkProductList($dataSet[ProductListDataSetInterface::ID_PRODUCT_LIST])
            ->filterByFkProduct($dataSet[ProductListDataSetInterface::ID_PRODUCT_CONCRETE])
            ->findOneOrCreate();

        $productListProductConcreteEntity->setFkProductList($dataSet[ProductListDataSetInterface::ID_PRODUCT_LIST])
            ->setFkProduct($dataSet[ProductListDataSetInterface::ID_PRODUCT_CONCRETE])
            ->save();

        $this->addPublishEvents(
            ProductListEvents::PRODUCT_LIST_PRODUCT_CONCRETE_PUBLISH,
            $productListProductConcreteEntity->getFkProduct()
        );
    }
290383
public function execute(DataSetInterface $dataSet): void
    {
        $companyUserKey = $dataSet[ShoppingListCompanyUserDataSetInterface::COLUMN_COMPANY_USER_KEY];
        if (!isset($this->idCompanyUserCache[$companyUserKey])) {
            $companyUserQuery = new SpyCompanyUserQuery();
            $idCompanyUser = $companyUserQuery
                ->select([SpyCompanyUserTableMap::COL_ID_COMPANY_USER])
                ->findOneByKey($companyUserKey);

            if (!$idCompanyUser) {
                throw new EntityNotFoundException(sprintf('Could not find company user by key "%s"', $companyUserKey));
            }

            $this->idCompanyUserCache[$companyUserKey] = $idCompanyUser;
        }

        $dataSet[ShoppingListCompanyUserDataSetInterface::ID_COMPANY_USER] = $this->idCompanyUserCache[$companyUserKey];
    }
925262
protected function saveProductMeasurementBaseUnit(DataSetInterface $dataSet): SpyProductMeasurementBaseUnit
    {
        $productMeasurementBaseUnitEntity = SpyProductMeasurementBaseUnitQuery::create()
            ->filterByFkProductAbstract($this->getIdProductAbstractBySku($dataSet[ProductMeasurementBaseUnitDataSet::COLUMN_ABSTRACT_SKU]))
            ->findOneOrCreate();

        $productMeasurementBaseUnitEntity
            ->setFkProductMeasurementUnit($this->getProductMeasurementUnitIdByCode($dataSet[ProductMeasurementBaseUnitDataSet::COLUMN_CODE]))
            ->save();

        return $productMeasurementBaseUnitEntity;
    }