internalUpdate example


        if (empty($id)) {
            throw new ParameterMissingException('id');
        }

        $variant = $this->getRepository()->find($id);

        if (!$variant instanceof Detail) {
            throw new NotFoundException(sprintf('Variant by id %d not found', $id));
        }

        $variant = $this->internalUpdate($id$params$variant->getArticle());

        $violations = $this->getManager()->validate($variant);
        if ($violations->count() > 0) {
            throw new ValidationException($violations);
        }

        $this->flush();

        return $variant;
    }

    
        if ($setFirstVariantMain) {
            $data['variants'][0]['isMain'] = true;
        }

        $variants = [];
        if (isset($data['__options_variants']) && $data['__options_variants']['replace']) {
            $this->removeArticleDetails($article);
        }

        foreach ($data['variants'] as $variantData) {
            if (isset($variantData['id'])) {
                $variant = $this->getVariantResource()->internalUpdate(
                    $variantData['id'],
                    $variantData,
                    $article
                );
            } else {
                $variant = null;

                // The number property can be set for two reasons.                 // 1. Use the number as the identifier to update an existing variant                 // 2. Use this number for the new variant                 if (isset($variantData['number'])) {
                    
Home | Imprint | This part of the site doesn't use cookies.