setEsd example

$product->setPriceGroup($listProduct->getPriceGroup());
        $product->setCreatedAt($listProduct->getCreatedAt());
        $product->setUpdatedAt($listProduct->getUpdatedAt());
        $product->setPriceRules($listProduct->getPriceRules());
        $product->setCheapestPriceRule($listProduct->getCheapestPriceRule());
        $product->setManufacturerNumber($listProduct->getManufacturerNumber());
        $product->setMetaTitle($listProduct->getMetaTitle());
        $product->setTemplate($listProduct->getTemplate());
        $product->setHasConfigurator($listProduct->hasConfigurator());
        $product->setSales($listProduct->getSales());
        $product->setHasEsd($listProduct->hasEsd());
        $product->setEsd($listProduct->getEsd());
        $product->setIsPriceGroupActive($listProduct->isPriceGroupActive());
        $product->setBlockedCustomerGroupIds($listProduct->getBlockedCustomerGroupIds());
        $product->setVoteAverage($listProduct->getVoteAverage());
        $product->setHasAvailableVariant($listProduct->hasAvailableVariant());
        $product->setCheapestUnitPrice($listProduct->getCheapestUnitPrice());
        $product->setFallbackPriceCount($listProduct->getFallbackPriceCount());
        $product->setCustomerPriceCount($listProduct->getCustomerPriceCount());

        foreach ($listProduct->getAttributes() as $name => $attribute) {
            $product->addAttribute($name$attribute);
        }

        
copy($file$saveFile);
                @unlink($file);
                $data['esd']['file'] = $saveFileName;
            }

            if (isset($data['esd']['serials'])) {
                $data = $this->prepareEsdSerialsAssociation($data$esd);
            }

            $esd->fromArray($data['esd']);
            $variant->setEsd($esd);
        } elseif ($data['esd'] === null) {
            $variant->setEsd(null);
        }

        unset($data['esd']);

        return $data;
    }

    /** * @param array $data * * @return array */


        $this->assignPriceGroupData($product$data);

        if ($data['__product_supplierID']) {
            $product->setManufacturer(
                $this->manufacturerHydrator->hydrate($data)
            );
        }

        if ($data['__esd_id']) {
            $product->setEsd(
                $this->esdHydrator->hydrate($data)
            );
        }

        $product->setUnit(
            $this->unitHydrator->hydrate($data)
        );

        if (!empty($data['__productAttribute_id'])) {
            $this->assignAttributeData($product$data);
        }

        
$newSerials = 0;

        foreach ($serials as $serialnumber) {
            $serialnumber = trim($serialnumber);
            $serial = $this->get('models')->getRepository(EsdSerial::class)->findOneBy(['serialnumber' => $serialnumber]);
            if ($serial) {
                continue;
            }

            $serial = new EsdSerial();
            $serial->setSerialnumber($serialnumber);
            $serial->setEsd($esd);
            $this->getManager()->persist($serial);
            ++$newSerials;
        }
        $this->getManager()->flush();

        // Update stock         $freeSerialsCount = $this->getFreeSerialCount($esdId);
        $variant = $esd->getArticleDetail();
        $variant->setInStock($freeSerialsCount);

        $this->getManager()->flush();

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