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

@return bool
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;
    }
898756
public function execute(DataSetInterface $dataSet): void
    {
        $dataSet[CompanyBusinessUnitDataSet::ID_COMPANY] = $this->getIdCompanyByKey($dataSet[CompanyBusinessUnitDataSet::COMPANY_KEY]);
    }
1222559
public function execute(DataSetInterface $dataSet): void
    {
        $productMeasurementUnitEntity = $this->saveProductMeasurementUnit($dataSet);

        $this->addPublishEvents(
            static::PRODUCT_MEASUREMENT_UNIT_PUBLISH,
            $productMeasurementUnitEntity->getIdProductMeasurementUnit()
        );
    }
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);
        }
    }
1267746
protected function saveProductList(DataSetInterface $dataSet): void
    {
        $productListKey = $dataSet[ProductListDataSetInterface::PRODUCT_LIST_KEY];
        if (!$productListKey) {
            throw new InvalidDataException(sprintf('"%s" is required.', ProductListDataSetInterface::PRODUCT_LIST_KEY));
        }

        $productListEntity = SpyProductListQuery::create()
            ->filterByKey($productListKey)
            ->findOneOrCreate();

        $productListEntity->setKey($productListKey)
            ->setTitle($dataSet[ProductListDataSetInterface::PRODUCT_LIST_NAME])
            ->setType($dataSet[ProductListDataSetInterface::PRODUCT_LIST_TYPE])
            ->save();

        $this->addPublishEvents(
            ProductListEvents::PRODUCT_LIST_PUBLISH,
            $productListEntity->getIdProductList()
        );
    }
1209844
public function execute(DataSetInterface $dataSet): void
    {
        $priceTypeEntity = SpyPriceTypeQuery::create()
            ->filterByName($dataSet[PriceProductDataSet::KEY_PRICE_TYPE])
            ->findOneOrCreate();

        if ($priceTypeEntity->isNew() || $priceTypeEntity->isModified()) {
            $priceTypeEntity->setPriceModeConfiguration(SpyPriceTypeTableMap::COL_PRICE_MODE_CONFIGURATION_BOTH);
            $priceTypeEntity->save();
        }

        $priceProductQuery = SpyPriceProductQuery::create();
        $priceProductQuery->filterByFkPriceType($priceTypeEntity->getIdPriceType());

        if (empty($dataSet[PriceProductDataSet::KEY_ABSTRACT_SKU]) && empty($dataSet[PriceProductDataSet::KEY_CONCRETE_SKU])) {
            throw new DataKeyNotFoundInDataSetException(sprintf(
                'One of "%s" or "%s" must be in the data set. Given: "%s"',
                PriceProductDataSet::KEY_ABSTRACT_SKU,
                PriceProductDataSet::KEY_CONCRETE_SKU,
                implode(', ', array_keys($dataSet->getArrayCopy()))
            ));
        }

        if (!empty($dataSet[PriceProductDataSet::KEY_ABSTRACT_SKU])) {
            $priceProductQuery->filterByFkProductAbstract($dataSet[PriceProductDataSet::ID_PRODUCT_ABSTRACT]);
            $this->addPublishEvents(PriceProductEvents::PRICE_ABSTRACT_PUBLISH, $dataSet[PriceProductDataSet::ID_PRODUCT_ABSTRACT]);
            $this->addPublishEvents(ProductEvents::PRODUCT_ABSTRACT_PUBLISH, $dataSet[PriceProductDataSet::ID_PRODUCT_ABSTRACT]);
        } else {
            $this->addPublishEvents(PriceProductEvents::PRICE_CONCRETE_PUBLISH, $dataSet[PriceProductDataSet::ID_PRODUCT_CONCRETE]);
            $priceProductQuery->filterByFkProduct($dataSet[PriceProductDataSet::ID_PRODUCT_CONCRETE]);
        }

        $productPriceEntity = $priceProductQuery->findOneOrCreate();
        $productPriceEntity->save();

        $priceProductStoreEntity = SpyPriceProductStoreQuery::create()
            ->filterByFkStore($dataSet[PriceProductDataSet::ID_STORE])
            ->filterByFkCurrency($dataSet[PriceProductDataSet::ID_CURRENCY])
            ->filterByFkPriceProduct($productPriceEntity->getPrimaryKey())
            ->findOneOrCreate();

        $priceProductStoreEntity->setGrossPrice($dataSet[PriceProductDataSet::KEY_PRICE_GROSS]);
        $priceProductStoreEntity->setNetPrice($dataSet[PriceProductDataSet::KEY_PRICE_NET]);
        $priceProductStoreEntity->setPriceData($dataSet[PriceProductDataSet::KEY_PRICE_DATA]);
        $priceProductStoreEntity->setPriceDataChecksum($dataSet[PriceProductDataSet::KEY_PRICE_DATA_CHECKSUM]);

        $priceProductStoreEntity->save();

        $this->savePriceProductDefault($priceProductStoreEntity->getPrimaryKey());
    }
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];
    }
51219
public function execute(DataSetInterface $dataSet)
    {
        $categoryEntity = $this->findOrCreateCategory($dataSet);
        $this->findOrCreateAttributes($categoryEntity, $dataSet);
        $categoryNodeEntity = $this->findOrCreateNode($categoryEntity, $dataSet);

        $this->categoryReader->addCategory($categoryEntity, $categoryNodeEntity);
    }
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()
        );
    }
392581
public function execute(DataSetInterface $dataSet)
    {
        $concreteSku = $dataSet[ProductDiscontinuedDataSetInterface::KEY_CONCRETE_SKU];
        if (!isset($this->idProductCache[$concreteSku])) {
            /** @var \Orm\Zed\Product\Persistence\SpyProductQuery $productQuery */
            $productQuery = SpyProductQuery::create()
                ->select(SpyProductTableMap::COL_ID_PRODUCT);
            /** @var string|int|null $idProduct */
            $idProduct = $productQuery
                ->findOneBySku($concreteSku);

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

            $this->idProductCache[$concreteSku] = (int)$idProduct;
        }

        $dataSet[ProductDiscontinuedDataSetInterface::ID_PRODUCT] = $this->idProductCache[$concreteSku];
    }
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];
    }
1191811
public function execute(DataSetInterface $dataSet)
    {
        $localizedNotes = [];
        foreach ($dataSet[ProductDiscontinuedDataSetInterface::KEY_LOCALES] as $localeName => $idLocale) {
            $key = ProductDiscontinuedDataSetInterface::KEY_NOTE . '.' . $localeName;
            if (!isset($dataSet[$key])) {
                throw new InvalidDataException(
                    sprintf('Could not find note for locale "%s" and sku "%s"', $localeName, $dataSet[ProductDiscontinuedDataSetInterface::KEY_CONCRETE_SKU])
                );
            }
            if (empty($dataSet[$key])) {
                continue;
            }
            $localizedNotes[$idLocale] = [
                ProductDiscontinuedDataSetInterface::KEY_NOTE => $dataSet[$key],
            ];
        }

        $dataSet[ProductDiscontinuedDataSetInterface::KEY_LOCALIZED_NOTES] = $localizedNotes;
    }
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];
    }
154034
public function execute(DataSetInterface $dataSet): void
    {
        $companyBusinessUnitEntity = SpyCompanyBusinessUnitQuery::create()
            ->filterByKey($dataSet[CompanyBusinessUnitDataSet::BUSINESS_UNIT_KEY])
            ->filterByFkCompany($dataSet[CompanyBusinessUnitDataSet::ID_COMPANY])
            ->findOneOrCreate();

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

        $companyBusinessUnitEntity->save();
    }
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();
        }
    }
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.');
        }
    }