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

@return void
190712
public function execute(DataSetInterface $dataSet): void
    {
        $companyBusinessUnitKey = $dataSet[CompanyBusinessUnitDataSet::PARENT_BUSINESS_UNIT_KEY];
        if (!$companyBusinessUnitKey) {
            return;
        }

        $dataSet[CompanyBusinessUnitDataSet::FK_PARENT_BUSINESS_UNIT] = $this->businessUnitDataImportRepository
            ->getIdCompanyBusinessUnitByKey($companyBusinessUnitKey);
    }
355953
public function execute(DataSetInterface $dataSet): void
    {
        if (empty($dataSet[PriceProductMerchantRelationshipDataSetInterface::ABSTRACT_SKU]) && empty($dataSet[PriceProductMerchantRelationshipDataSetInterface::CONCRETE_SKU])) {
            throw new DataKeyNotFoundInDataSetException(sprintf(
                'One of "%s" or "%s" must be in the data set. Given: "%s"',
                PriceProductMerchantRelationshipDataSetInterface::ABSTRACT_SKU,
                PriceProductMerchantRelationshipDataSetInterface::CONCRETE_SKU,
                implode(', ', array_keys($dataSet->getArrayCopy()))
            ));
        }

        $productAbstractSku = $dataSet[PriceProductMerchantRelationshipDataSetInterface::ABSTRACT_SKU];
        if (!empty($productAbstractSku)) {
            $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRODUCT_ABSTRACT] = $this->resolveIdProductByAbstractSku($productAbstractSku);
        }

        $productConcreteSku = $dataSet[PriceProductMerchantRelationshipDataSetInterface::CONCRETE_SKU];
        if (!empty($productConcreteSku)) {
            $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRODUCT_CONCRETE] = $this->resolveIdProductByConcreteSku($productConcreteSku);
        }
    }
897113
public function execute(DataSetInterface $dataSet)
    {
        $companyUnitAddressLabelToCompanyUnitAddressEntity = SpyCompanyUnitAddressLabelToCompanyUnitAddressQuery::create()
            ->filterByFkCompanyUnitAddress($dataSet[CompanyUnitAddressLabelRelationDataSet::ID_COMPANY_UNIT_ADDRESS])
            ->filterByFkCompanyUnitAddressLabel($dataSet[CompanyUnitAddressLabelRelationDataSet::ID_COMPANY_UNIT_ADDRESS_LABEL])
            ->findOneOrCreate();

        $companyUnitAddressLabelToCompanyUnitAddressEntity->save();
    }
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];
    }
253570
protected function processDataSet(DataSet $dataSet)
    {
        if ($dataSet->getPattern() === File::HEADER_PATTERN) {
            $this->processHeader($dataSet);
        } else {
            $this->processBrowserData($dataSet);
        }
    }
8213
public function execute(DataSetInterface $dataSet): void
    {
        $merchantRelationshipKey = $dataSet[MerchantRelationshipProductListDataSetInterface::MERCHANT_RELATION_KEY];
        if (!$merchantRelationshipKey) {
            throw new InvalidDataException(sprintf('"%s" is required.', MerchantRelationshipProductListDataSetInterface::MERCHANT_RELATION_KEY));
        }

        if (!isset($this->idMerchantRelationshipCache[$merchantRelationshipKey])) {
            /** @var \Orm\Zed\MerchantRelationship\Persistence\SpyMerchantRelationshipQuery $merchantRelationshipQuery */
            $merchantRelationshipQuery = SpyMerchantRelationshipQuery::create()->select(SpyMerchantRelationshipTableMap::COL_ID_MERCHANT_RELATIONSHIP);
            /** @var int|null $idMerchantRelationship */
            $idMerchantRelationship = $merchantRelationshipQuery->findOneByMerchantRelationshipKey($merchantRelationshipKey);

            if (!$idMerchantRelationship) {
                throw new EntityNotFoundException(sprintf('Could not find Merchant Relationship by key "%s"', $merchantRelationshipKey));
            }
            $this->idMerchantRelationshipCache[$merchantRelationshipKey] = $idMerchantRelationship;
        }
        $dataSet[MerchantRelationshipProductListDataSetInterface::ID_MERCHANT_RELATIONSHIP] = $this->idMerchantRelationshipCache[$merchantRelationshipKey];
    }
964517
protected function getIso2Code(DataSetInterface $dataSet)
    {
        if (isset($dataSet[CompanyUnitAddressDataSet::COUNTRY_ISO_2_CODE]) && !empty($dataSet[CompanyUnitAddressDataSet::COUNTRY_ISO_2_CODE])) {
            return $dataSet[CompanyUnitAddressDataSet::COUNTRY_ISO_2_CODE];
        }

        return null;
    }
1049138
public function execute(DataSetInterface $dataSet): void
    {
        $productAbstractSku = $dataSet[PriceProductDataSet::KEY_ABSTRACT_SKU];
        if (empty($productAbstractSku)) {
            return;
        }

        if (!isset($this->idProductAbstractCache[$productAbstractSku])) {
            $productQuery = new SpyProductAbstractQuery();
            $idProduct = $productQuery
                ->select(SpyProductAbstractTableMap::COL_ID_PRODUCT_ABSTRACT)
                ->findOneBySku($productAbstractSku);

            if (!$idProduct) {
                throw new EntityNotFoundException(sprintf('Could not find abstract product by sku "%s"', $productAbstractSku));
            }

            $this->idProductAbstractCache[$productAbstractSku] = $idProduct;
        }

        $dataSet[PriceProductDataSet::ID_PRODUCT_ABSTRACT] = $this->idProductAbstractCache[$productAbstractSku];
    }
605091
public function execute(DataSetInterface $dataSet): void
    {
        $storeName = $dataSet[CartDataSetInterface::KEY_STORE];
        if (!isset($this->idStoreCache[$storeName])) {
            $storeQuery = new SpyStoreQuery();
            $idStore = $storeQuery
                ->select(SpyStoreTableMap::COL_ID_STORE)
                ->findOneByName($storeName);

            if (!$idStore) {
                throw new EntityNotFoundException(sprintf('Could not find store by name "%s"', $storeName));
            }

            $this->idStoreCache[$storeName] = $idStore;
        }

        $dataSet[CartDataSetInterface::ID_STORE] = $this->idStoreCache[$storeName];
    }
663132
public function execute(DataSetInterface $dataSet): void
    {
        $productPackagingUnitTypeEntity = $this->getProductPackagingUnitTypeQuery()
            ->filterByName($dataSet[ProductPackagingUnitTypeDataSetInterface::COLUMN_NAME])
            ->findOneOrCreate();

        if ($productPackagingUnitTypeEntity->isNew()) {
            $productPackagingUnitTypeEntity->save();
        }
    }
286412
public function execute(DataSetInterface $dataSet): void
    {
        $priceProductMerchantRelationshipEntity = $this->findExistingPriceProductStoreEntity($dataSet);

        $idPriceProductStore = $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRICE_PRODUCT_STORE];
        if ($priceProductMerchantRelationshipEntity
            && $priceProductMerchantRelationshipEntity->getFkPriceProductStore() === $idPriceProductStore) {
            return;
        }

        if (!$priceProductMerchantRelationshipEntity) {
            $priceProductMerchantRelationshipEntity = (new SpyPriceProductMerchantRelationship())
                ->setFkMerchantRelationship($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_MERCHANT_RELATIONSHIP]);

            if (!empty($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRODUCT_ABSTRACT])) {
                $priceProductMerchantRelationshipEntity->setFkProductAbstract($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRODUCT_ABSTRACT]);
            } else {
                $priceProductMerchantRelationshipEntity->setFkProduct($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRODUCT_CONCRETE]);
            }
        }

        $priceProductMerchantRelationshipEntity->setFkPriceProductStore($idPriceProductStore);

        $eventName = $priceProductMerchantRelationshipEntity->isNew()
            ? PriceProductMerchantRelationshipDataImportConstants::ENTITY_SPY_PRICE_PRODUCT_MERCHANT_RELATIONSHIP_CREATE
            : PriceProductMerchantRelationshipDataImportConstants::ENTITY_SPY_PRICE_PRODUCT_MERCHANT_RELATIONSHIP_UPDATE;

        $priceProductMerchantRelationshipEntity->save();

        $this->addPublishEvents(
            $eventName,
            (int)$priceProductMerchantRelationshipEntity->getPrimaryKey()
        );
    }
1132138
public function train(Dataset $dataset) : void
    {
        DatasetIsCompatibleWithEstimator::check($dataset, $this);

        $this->model = $this->svm->train($dataset->samples());
    }
1299570
protected function validateDataSet(DataSetInterface $dataSet): void
    {
        if (!$dataSet[MerchantDataSetInterface::MERCHANT_KEY]) {
            throw new InvalidDataException('"' . MerchantDataSetInterface::MERCHANT_KEY . '" is required.');
        }

        if (!$dataSet[MerchantDataSetInterface::NAME]) {
            throw new InvalidDataException('"' . MerchantDataSetInterface::NAME . '" is required.');
        }
    }
690282
public function execute(DataSetInterface $dataSet)
    {
        $this->preparePriceDataKeysCache($dataSet);
        $priceData = $this->getPriceData($dataSet);
        if ($priceData === null) {
            $dataSet[PriceProductDataSet::KEY_PRICE_DATA] = null;
            $dataSet[PriceProductDataSet::KEY_PRICE_DATA_CHECKSUM] = null;

            return;
        }
        $dataSet[PriceProductDataSet::KEY_PRICE_DATA] = $this->utilEncodingService->encodeJson($priceData);
        $dataSet[PriceProductDataSet::KEY_PRICE_DATA_CHECKSUM] = $this->priceProductFacade
            ->generatePriceDataChecksum($priceData);
    }
1168846
public function execute(DataSetInterface $dataSet): void
    {
        $shoppingListPermissionGroupName = $dataSet[ShoppingListCompanyUserDataSetInterface::COLUMN_PERMISSION_GROUP_NAME];
        if (!isset($this->idPermissionGroupCache[$shoppingListPermissionGroupName])) {
            $shoppingListPermissionGroupQuery = new SpyShoppingListPermissionGroupQuery();
            $idPermissionGroup = $shoppingListPermissionGroupQuery
                ->select([SpyShoppingListPermissionGroupTableMap::COL_ID_SHOPPING_LIST_PERMISSION_GROUP])
                ->findOneByName($shoppingListPermissionGroupName);

            if (!$idPermissionGroup) {
                throw new EntityNotFoundException(sprintf('Could not find shopping list permission group by name "%s"', $shoppingListPermissionGroupName));
            }

            $this->idPermissionGroupCache[$shoppingListPermissionGroupName] = $idPermissionGroup;
        }

        $dataSet[ShoppingListCompanyUserDataSetInterface::ID_PERMISSION_GROUP] = $this->idPermissionGroupCache[$shoppingListPermissionGroupName];
    }
238859
public function execute(DataSetInterface $dataSet): void
    {
        $merchantKey = $dataSet[MerchantRelationshipDataSetInterface::MERCHANT_KEY];
        if (!$merchantKey) {
            throw new InvalidDataException('"' . MerchantRelationshipDataSetInterface::MERCHANT_KEY . '" is required.');
        }

        if (!isset($this->idMerchantCache[$merchantKey])) {
            $idMerchant = SpyMerchantQuery::create()
                ->select(SpyMerchantTableMap::COL_ID_MERCHANT)
                ->findOneByMerchantKey($merchantKey);

            if (!$idMerchant) {
                throw new EntityNotFoundException(sprintf('Could not find Merchant by key "%s"', $merchantKey));
            }

            $this->idMerchantCache[$merchantKey] = $idMerchant;
        }

        $dataSet[MerchantRelationshipDataSetInterface::ID_MERCHANT] = $this->idMerchantCache[$merchantKey];
    }
947721
public function execute(DataSetInterface $dataSet): void
    {
        $idPermission = $this->getIdPermissionByKey($dataSet[CompanyRolePermissionDataSetInterface::COLUMN_PERMISSION_KEY]);
        $idCompanyRole = $this->getIdCompanyRoleByKey($dataSet[CompanyRolePermissionDataSetInterface::COLUMN_COMPANY_ROLE_KEY]);

        $companyRolePermissionEntity = SpyCompanyRoleToPermissionQuery::create()
            ->filterByFkCompanyRole($idCompanyRole)
            ->filterByFkPermission($idPermission)
            ->findOneOrCreate();

        $companyRolePermissionEntity
            ->setConfiguration($dataSet[CompanyRolePermissionDataSetInterface::COLUMN_CONFIGURATION])
            ->save();
    }