writeTranslations example

$product->fromArray($params);

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

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

        if (!empty($translations)) {
            $this->writeTranslations($product->getId()$translations);
        }

        return $product;
    }

    /** * Convenience method to update a product by number * * @param string $number * * @throws ValidationException * @throws NotFoundException * @throws ParameterMissingException * * @return ProductModel */


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

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

        if (!empty($params['translations'])) {
            $this->writeTranslations($category->getId()$params['translations']);
        }

        return $category;
    }

    /** * @param int $id * * @throws ValidationException * @throws NotFoundException * @throws ParameterMissingException * @throws CustomValidationException * * @return CategoryModel */
Home | Imprint | This part of the site doesn't use cookies.