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

@throws \Spryker\Zed\DataImport\Business\Exception\EntityNotFoundException

@return void
174041
public function execute(DataSetInterface $dataSet)
    {
        $companyKey = $dataSet[CompanyUnitAddressDataSet::COMPANY_KEY];
        if (!isset($this->idCompanyCache[$companyKey])) {
            $companyQuery = new SpyCompanyQuery();
            $idCompany = $companyQuery
                ->select(SpyCompanyTableMap::COL_ID_COMPANY)
                ->findOneByKey($companyKey);

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

            $this->idCompanyCache[$companyKey] = $idCompany;
        }

        $dataSet[CompanyUnitAddressDataSet::ID_COMPANY] = $this->idCompanyCache[$companyKey];
    }
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()
        );
    }
487880
protected function hasAmount(DataSetInterface $dataSet): bool
    {
        if ($dataSet[ProductPackagingUnitDataSetInterface::COLUMN_IS_LEAD_PRODUCT]) {
            return false;
        }

        if ($dataSet[ProductPackagingUnitDataSetInterface::COLUMN_IS_VARIABLE]) {
            return true;
        }

        if (empty($dataSet[ProductPackagingUnitDataSetInterface::COLUMN_DEFAULT_AMOUNT]) ||
            $dataSet[ProductPackagingUnitDataSetInterface::COLUMN_DEFAULT_AMOUNT] === static::DEFAULT_AMOUNT_DEFAULT_VALUE
        ) {
            return false;
        }

        return true;
    }
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();
    }
29798
protected function saveAbstractAlternative(DataSetInterface $dataSet, SpyProductAlternativeQuery $productAlternativeQuery): void
    {
        $productAlternativeEntity = $productAlternativeQuery->filterByFkProductAbstractAlternative(
            $dataSet[ProductAlternativeDataSetInterface::FK_PRODUCT_ABSTRACT_ALTERNATIVE]
        )
            ->findOneOrCreate()
            ->setFkProductAbstractAlternative(
                $dataSet[ProductAlternativeDataSetInterface::FK_PRODUCT_ABSTRACT_ALTERNATIVE]
            );
        $productAlternativeEntity->save();

        $fkProductAbstractAlternative = $productAlternativeEntity->getFkProductAbstractAlternative();

        if (!$fkProductAbstractAlternative) {
            return;
        }

        $this->addPublishEvents(
            ProductAlternativeEvents::PRODUCT_REPLACEMENT_ABSTRACT_PUBLISH,
            $fkProductAbstractAlternative
        );
        $this->addPublishEvents(
            ProductAlternativeEvents::PRODUCT_ALTERNATIVE_PUBLISH,
            $productAlternativeEntity->getFkProduct()
        );
    }
260194
public function execute(DataSetInterface $dataSet): void
    {
        $shoppingListCompanyUserEntity = $this->createShoppingListCompanyBusinessUnitQuery()
            ->filterByFkShoppingList($dataSet[ShoppingListCompanyBusinessUnitDataSetInterface::ID_SHOPPING_LIST])
            ->filterByFkCompanyBusinessUnit($dataSet[ShoppingListCompanyBusinessUnitDataSetInterface::ID_COMPANY_BUSINESS_UNIT])
            ->findOneOrCreate();

        $shoppingListCompanyUserEntity
            ->setFkShoppingListPermissionGroup($dataSet[ShoppingListCompanyBusinessUnitDataSetInterface::ID_PERMISSION_GROUP])
            ->save();
    }
1147232
protected function filterDataSet(DataSetInterface $dataSet): DataSetInterface
    {
        if ($dataSet[ProductMeasurementSalesUnitDataSet::COLUMN_CONVERSION] === "") {
            $dataSet[ProductMeasurementSalesUnitDataSet::COLUMN_CONVERSION] = null;
        }

        if ($dataSet[ProductMeasurementSalesUnitDataSet::COLUMN_PRECISION] === "") {
            $dataSet[ProductMeasurementSalesUnitDataSet::COLUMN_PRECISION] = null;
        }

        return $dataSet;
    }
141583
public function execute(DataSetInterface $dataSet): void
    {
        if (!$dataSet[MerchantRelationshipDataSetInterface::COMPANY_BUSINESS_UNIT_ASSIGNEE_KEYS]) {
            $dataSet[MerchantRelationshipDataSetInterface::ID_COMPANY_BUSINESS_UNIT_ASSIGNEE_COLLECTION] = [];

            return;
        }

        $companyBusinessUnitKeys = explode(
            $this->getAssigneeDelimiter(),
            $dataSet[MerchantRelationshipDataSetInterface::COMPANY_BUSINESS_UNIT_ASSIGNEE_KEYS]
        );

        $companyBusinessUnitAssignee = [];
        foreach ($companyBusinessUnitKeys as $companyBusinessUnitKey) {
            $companyBusinessUnitAssignee[] = $this->findIdCompanyBusinessUnit($companyBusinessUnitKey);
        }

        $dataSet[MerchantRelationshipDataSetInterface::ID_COMPANY_BUSINESS_UNIT_ASSIGNEE_COLLECTION] = $companyBusinessUnitAssignee;
    }
1295448
public function execute(DataSetInterface $dataSet): void
    {
        $merchantRelationshipEntity = SpyMerchantRelationshipQuery::create()
            ->filterByMerchantRelationshipKey($dataSet[MerchantRelationshipDataSetInterface::MERCHANT_RELATIONSHIP_KEY])
            ->findOneOrCreate();

        $merchantRelationshipEntity
            ->setFkMerchant($dataSet[MerchantRelationshipDataSetInterface::ID_MERCHANT])
            ->setFkCompanyBusinessUnit($dataSet[MerchantRelationshipDataSetInterface::ID_COMPANY_BUSINESS_UNIT])
            ->save();

        $this->saveMerchantRelationshipToCompanyBusinessUnit($dataSet, $merchantRelationshipEntity->getPrimaryKey());
    }
487786
public function train(Dataset $dataset) : void
    {
        if (!$dataset instanceof Labeled) {
            throw new InvalidArgumentException('This estimator requires a'
                . ' labeled training set.');
        }

        $this->strategy->fit($dataset->labels());

        $this->trained = true;
    }
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();
    }
1170022
public function execute(DataSetInterface $dataSet): void
    {
        $dataSet = $this->filterDataSet($dataSet);

        $spyProductMeasurementSalesUnitEntity = $this->saveProductMeasurementSalesUnit($dataSet);

        $this->addPublishEvents(
            static::PRODUCT_CONCRETE_MEASUREMENT_UNIT_PUBLISH,
            $spyProductMeasurementSalesUnitEntity->getFkProduct()
        );
    }
505920
public function execute(DataSetInterface $dataSet): void
    {
        $this->checkIfProductHasConcreteOrAbstractAlternative($dataSet);
        $this->checkIfProductHasConcreteAndAbstractAlternative($dataSet);
    }
1154815
protected function saveProductMeasurementSalesUnitStore(DataSetInterface $dataSet): void
    {
        SpyProductMeasurementSalesUnitStoreQuery::create()
            ->filterByFkProductMeasurementSalesUnit($this->getIdProductMeasurementSalesUnitByKey($dataSet[ProductMeasurementSalesUnitStoreDataSet::COLUMN_SALES_UNIT_KEY]))
            ->filterByFkStore($this->getIdStoreByName($dataSet[ProductMeasurementSalesUnitStoreDataSet::COLUMN_STORE_NAME]))
            ->findOneOrCreate()
            ->save();
    }
1023594
public function execute(DataSetInterface $dataSet)
    {
        $mimeTypeEntity = SpyMimeTypeQuery::create()
            ->filterByName($dataSet[MimeTypeDataSetInterface::KEY_NAME])
            ->findOneOrCreate();

        $mimeTypeEntity->setIsAllowed($dataSet[MimeTypeDataSetInterface::KEY_IS_ALLOWED]);
        $mimeTypeEntity->save();
    }
412166
public function execute(DataSetInterface $dataSet): void
    {
        $idCompanyBusinessUnit = $this->businessUnitDataImportRepository->getIdCompanyBusinessUnitByKey($dataSet[CompanyBusinessUnitUserDataSet::COLUMN_BUSINESS_UNIT_KEY]);

        $companyUserEntity = $this->createCompanyUserQuery()
            ->findOneByKey($dataSet[CompanyBusinessUnitUserDataSet::COLUMN_COMPANY_USER_KEY]);

        if ($companyUserEntity === null) {
            throw new EntityNotFoundException(sprintf('Could not find company user by key "%s"', $dataSet[CompanyBusinessUnitUserDataSet::COLUMN_COMPANY_USER_KEY]));
        }

        $companyUserEntity
            ->setFkCompanyBusinessUnit($idCompanyBusinessUnit)
            ->save();
    }
394850
public function execute(DataSetInterface $dataSet): void
    {
        $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRICE_PRODUCT_STORE] = $this->getIdPriceProductStoreEntity($dataSet);
    }