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

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

@return void
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);
        }
    }
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];
    }
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();
    }
1166868
public function execute(DataSetInterface $dataSet)
    {
        $companyUnitAddressLabelEntity = SpyCompanyUnitAddressLabelQuery::create()
            ->filterByName($dataSet[CompanyUnitAddressLabelDataSet::LABEL_NAME])
            ->findOneOrCreate();

        $companyUnitAddressLabelEntity->save();
    }
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);
    }
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()
        );
    }
264755
protected function saveProductListCategory(DataSetInterface $dataSet): void
    {
        $productListCategoryEntity = SpyProductListCategoryQuery::create()
            ->filterByFkProductList($dataSet[ProductListDataSetInterface::ID_PRODUCT_LIST])
            ->filterByFkCategory($dataSet[ProductListDataSetInterface::ID_CATEGORY])
            ->findOneOrCreate();

        $productListCategoryEntity->setFkProductList($dataSet[ProductListDataSetInterface::ID_PRODUCT_LIST])
            ->setFkCategory($dataSet[ProductListDataSetInterface::ID_CATEGORY])
            ->save();

        $this->addPublishEvents(
            ProductListEvents::PRODUCT_LIST_CATEGORY_PUBLISH,
            $productListCategoryEntity->getFkCategory()
        );
    }
473541
public function execute(DataSetInterface $dataSet): void
    {
        $dataSet = $this->filterDataSet($dataSet);

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

        $this->addPublishEvents(ProductQuantityEvents::PRODUCT_QUANTITY_PUBLISH, $spyProductQuantityEntity->getFkProduct());
    }
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();
        }
    }
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.');
        }
    }
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();
    }
219237
protected function bindDataset($dataset)
    {
        $datasetClass = $this->datasetClass;
        $object = new $datasetClass();

        if ($object instanceof DataSetInterface) {
            return $object->bind($dataset);
        }

        if ($dataset instanceof \Traversable) {
            $dataset = iterator_to_array($dataset);
        } elseif (is_object($dataset)) {
            $dataset = [$dataset];
        } elseif (!is_array($dataset)) {
            throw new \InvalidArgumentException(sprintf('Need an array or object in %s::%s()', __CLASS__, __METHOD__));
        }

        foreach ($dataset as $data) {
            $object[] = $data;
        }

        return $object;
    }
959146
public function train(Dataset $dataset) : void
    {
        DatasetIsCompatibleWithEstimator::check($dataset, $this);

        $this->centroids = $this->seeder->seed($dataset, $this->k);

        $sizes = array_fill(1, $this->k, 0);
        $sizes[0] = $dataset->numRows();

        $this->sizes = $sizes;

        $this->steps = [];

        $this->partial($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];
    }
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();
    }
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()
        );
    }