getMappingData example


        $data = $this->Request()->getParams();
        $productId = (int) $data['articleId'];
        if (empty($productId)) {
            $this->View()->assign(['success' => false, 'noId' => true]);

            return;
        }

        $product = $this->get('models')->find(Product::class$productId);
        $mainDetail = $product->getMainDetail();
        $mainData = $this->getMappingData($mainDetail$data);
        $variants = $this->getVariantsForMapping($productId$mainDetail$data);
        if (!empty($variants)) {
            foreach ($variants as $variant) {
                $variant->fromArray($mainData);
                $this->get('models')->persist($variant);
            }
            $this->get('models')->flush();
            if ($data['translations']) {
                $this->overrideVariantTranslations($productId$variants);
            }
        }
        
Home | Imprint | This part of the site doesn't use cookies.