checkDataReplacement example


    protected function prepareSeoCategoryAssociatedData($data, ProductModel $article)
    {
        if (!isset($data['seoCategories'])) {
            return $data;
        }

        $seoCategories = $this->checkDataReplacement(
            $article->getSeoCategories(),
            $data,
            'seoCategories',
            true
        );
        /** @var ArrayCollection<array-key, Category> $categories */
        $categories = $data['categories'];

        foreach ($data['seoCategories'] as $categoryData) {
            $seoCategory = $this->getOneToManySubElement(
                $seoCategories,
                

                        'accountNumber' => $data['debit']['account'],
                        'bankCode' => $data['debit']['bankCode'],
                        'bankName' => $data['debit']['bankName'],
                        'accountHolder' => $data['debit']['accountHolder'],
                        'paymentMeanId' => $debitPaymentMean->getId(),
                    ],
                ];
            }
        }

        $paymentDataInstances = $this->checkDataReplacement(
            $customer->getPaymentData(),
            $data,
            'paymentData',
            false
        );

        foreach ($data['paymentData'] as &$paymentDataData) {
            try {
                $paymentData = $this->getOneToManySubElement(
                    $paymentDataInstances,
                    $paymentDataData,
                    
$mapping = $this->getVariantMappingOfImage($image$variant);

                    if ($mapping) {
                        $this->getManager()->remove($mapping);
                    }
                }
            }

            return $data;
        }

        $images = $this->checkDataReplacement(
            $variant->getImages(),
            $data,
            'images',
            true
        );
        foreach ($data['images'] as $imageData) {
            // Check if a media id was passed.             if (isset($imageData['mediaId'])) {
                // First check if the media object is already assigned to the product                 $image = $this->getAvailableMediaImage(
                    $article->getImages(),
                    
if (empty($details)) {
            unset($params['details']);

            return $params;
        }

        foreach ($details as &$detail) {
            $detail = array_intersect_key($detailarray_flip($allowedOrderDetailFields));
        }
        unset($detail);

        $detailModels = $this->checkDataReplacement(new ArrayCollection($order->getDetails()->toArray())$params, 'details', true);

        foreach ($details as $detail) {
            $detailModel = $this->getOneToManySubElement($order->getDetails()$detail, Detail::class);

            if (empty($detailModel->getId())) {
                // skip new entries                 continue;
            }

            if (isset($detail['status'])) {
                $status = Shopware()->Models()->find(DetailStatus::class$detail['status']);

                
Home | Imprint | This part of the site doesn't use cookies.