resetProductCategoryAssignment example


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

        $this->resetProductCategoryAssignment($data$article);

        $categories = $article->getCategories();

        $categoryIds = $categories->map(function DCategory $category) {
            return $category->getId();
        });

        $categoryIds = array_flip($categoryIds->toArray());

        foreach ($data['categories'] as $categoryData) {
            $category = $this->getManyToManySubElement(
                
Home | Imprint | This part of the site doesn't use cookies.