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

@return string
173074
protected function getIdPriceProductStoreEntity(DataSetInterface $dataSet): string
    {
        $cacheIndex = $this->buildCacheIndex($dataSet);
        if (isset($this->idPriceProductStoreCache[$cacheIndex])) {
            return $this->idPriceProductStoreCache[$cacheIndex];
        }

        $priceProductStoreEntity = SpyPriceProductStoreQuery::create()
            ->filterByFkStore($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_STORE])
            ->filterByFkCurrency($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_CURRENCY])
            ->filterByFkPriceProduct($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRICE_PRODUCT])
            ->filterByNetPrice((int)$dataSet[PriceProductMerchantRelationshipDataSetInterface::PRICE_NET])
            ->filterByGrossPrice((int)$dataSet[PriceProductMerchantRelationshipDataSetInterface::PRICE_GROSS])
            ->findOneOrCreate();

        $priceProductStoreEntity->save();

        $this->idPriceProductStoreCache[$cacheIndex] = $priceProductStoreEntity->getIdPriceProductStore();

        return $this->idPriceProductStoreCache[$cacheIndex];
    }
1166868
public function execute(DataSetInterface $dataSet)
    {
        $companyUnitAddressLabelEntity = SpyCompanyUnitAddressLabelQuery::create()
            ->filterByName($dataSet[CompanyUnitAddressLabelDataSet::LABEL_NAME])
            ->findOneOrCreate();

        $companyUnitAddressLabelEntity->save();
    }
1134134
public function execute(DataSetInterface $dataSet): void
    {
        $merchantRelationshipKey = $dataSet[PriceProductMerchantRelationshipDataSetInterface::MERCHANT_RELATIONSHIP_KEY];
        if (!isset($this->idMerchantRelationshipCache[$merchantRelationshipKey])) {
            $idMerchantRelationship = SpyMerchantRelationshipQuery::create()
                ->select(SpyMerchantRelationshipTableMap::COL_ID_MERCHANT_RELATIONSHIP)
                ->findOneByMerchantRelationshipKey($merchantRelationshipKey);

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

            $this->idMerchantRelationshipCache[$merchantRelationshipKey] = $idMerchantRelationship;
        }

        $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_MERCHANT_RELATIONSHIP] = $this->idMerchantRelationshipCache[$merchantRelationshipKey];
    }
95279
private function getMacSource(Dataset $dataset)
    {
        $macParams = $this->getNormalizedMacParams($dataset, $dataset->getParam('VK_SERVICE'));
        $source = '';

        foreach ($macParams as $value) {
            $length = $this->getParamValueLength($value);
            $source .= str_pad($length, 3, '0', STR_PAD_LEFT) . $value;
        }

        return $source;
    }
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;
    }
1199052
public function execute(DataSetInterface $dataSet): void
    {
        $productConcreteSku = $dataSet[PriceProductDataSet::KEY_CONCRETE_SKU];
        if (empty($productConcreteSku)) {
            return;
        }

        if (!isset($this->idProductCache[$productConcreteSku])) {
            $productQuery = new SpyProductQuery();
            $idProduct = $productQuery
                ->select(SpyProductTableMap::COL_ID_PRODUCT)
                ->findOneBySku($productConcreteSku);

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

            $this->idProductCache[$productConcreteSku] = $idProduct;
        }

        $dataSet[PriceProductDataSet::ID_PRODUCT_CONCRETE] = $this->idProductCache[$productConcreteSku];
    }
523674
protected function loadConfig($dataset)
    {
        $config_file = $this->getDatasets($dataset);
        $config = include $config_file;
        $this->checkConfig($config);

        return $config;
    }
496511
public function execute(DataSetInterface $dataSet): void
    {
        $shoppingListEntity = $this->createShoppingListQuery()
            ->filterByKey($dataSet[ShoppingListDataSetInterface::COLUMN_KEY])
            ->findOneOrCreate();

        $shoppingListEntity
            ->setName($dataSet[ShoppingListDataSetInterface::COLUMN_NAME])
            ->setCustomerReference($dataSet[ShoppingListDataSetInterface::COLUMN_OWNER_CUSTOMER_REFERENCE])
            ->save();
    }
1177700
public function execute(DataSetInterface $dataSet): void
    {
        $idCompanyBusinessUnit = $this->businessUnitDataImportRepository
            ->getIdCompanyBusinessUnitByKey($dataSet[CompanyBusinessUnitAddressDataSet::COLUMN_BUSINESS_UNIT_KEY]);
        $idCompanyUnitAddress = $this->getIdCompanyUnitAddressByKey($dataSet[CompanyBusinessUnitAddressDataSet::COLUMN_ADDRESS_KEY]);

        $this->createCompanyUnitAddressToCompanyBusinessUnitQuery()
            ->filterByFkCompanyBusinessUnit($idCompanyBusinessUnit)
            ->filterByFKCompanyUnitAddress($idCompanyUnitAddress)
            ->findOneOrCreate()
            ->save();
    }
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;
    }
1344262
public function execute(DataSetInterface $dataSet)
    {
        $productDiscontinuedEntity = SpyProductDiscontinuedQuery::create()
            ->filterByFkProduct($dataSet[ProductDiscontinuedDataSetInterface::ID_PRODUCT])
            ->findOneOrCreate();

        $productDiscontinuedEntity->setActiveUntil($this->getActiveUntilDate());

        $productDiscontinuedEntity->save();

        $this->saveLocalizedNotes($productDiscontinuedEntity, $dataSet);

        $this->addPublishEvents(
            ProductDiscontinuedEvents::PRODUCT_DISCONTINUED_PUBLISH,
            $productDiscontinuedEntity->getIdProductDiscontinued()
        );
    }
394850
public function execute(DataSetInterface $dataSet): void
    {
        $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRICE_PRODUCT_STORE] = $this->getIdPriceProductStoreEntity($dataSet);
    }
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];
    }
1311559
public function execute(DataSetInterface $dataSet): void
    {
        $productSku = $dataSet[ProductAlternativeDataSetInterface::KEY_COLUMN_CONCRETE_SKU];

        if (!isset($this->idProductCache[$productSku])) {
            $productEntity = SpyProductQuery::create()->findOneBySku($productSku);
            if (!$productEntity) {
                throw new EntityNotFoundException(sprintf('Could not find product by sku "%s"', $productSku));
            }

            $this->idProductCache[$productSku] = $productEntity->getIdProduct();
        }

        $dataSet[ProductAlternativeDataSetInterface::FK_PRODUCT] = $this->idProductCache[$productSku];
    }
473541
public function execute(DataSetInterface $dataSet): void
    {
        $dataSet = $this->filterDataSet($dataSet);

        $spyProductQuantityEntity = $this->saveProductQuantity($dataSet);

        $this->addPublishEvents(ProductQuantityEvents::PRODUCT_QUANTITY_PUBLISH, $spyProductQuantityEntity->getFkProduct());
    }
1326307
protected function addAlternativeProductConcreteId(DataSetInterface $dataSet): void
    {
        $productConcreteSku = $dataSet[ProductAlternativeDataSetInterface::KEY_COLUMN_ALTERNATIVE_PRODUCT_CONCRETE_SKU];

        if (!isset($this->idProductConcreteCache[$productConcreteSku])) {
            /** @var \Orm\Zed\Product\Persistence\SpyProduct|null $productConcreteEntity */
            $productConcreteEntity = SpyProductQuery::create()->findOneBySku($productConcreteSku);
            if (!$productConcreteEntity) {
                throw new EntityNotFoundException(
                    sprintf(
                        'Could not find product by sku "%s"',
                        $productConcreteSku
                    )
                );
            }

            $this->idProductConcreteCache[$productConcreteSku] = $productConcreteEntity->getIdProduct();
        }
        $dataSet[ProductAlternativeDataSetInterface::FK_PRODUCT_CONCRETE_ALTERNATIVE] = $this->idProductConcreteCache[$productConcreteSku];
    }
908813
protected function findExistingPriceProductStoreEntity(DataSetInterface $dataSet): ?SpyPriceProductMerchantRelationship
    {
        $query = SpyPriceProductMerchantRelationshipQuery::create()
            ->usePriceProductStoreQuery()
                ->filterByFkStore($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_STORE])
                ->filterByFkCurrency($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_CURRENCY])
                ->filterByFkPriceProduct($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRICE_PRODUCT])
            ->endUse()
            ->filterByFkMerchantRelationship($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_MERCHANT_RELATIONSHIP]);

        if (!empty($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRODUCT_ABSTRACT])) {
            $query->filterByFkProductAbstract($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRODUCT_ABSTRACT]);
        } else {
            $query->filterByFkProduct($dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRODUCT_CONCRETE]);
        }

        return $query->findOne();
    }