getManyToManySubElement example

$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(
                $categories,
                $categoryData,
                Category::class
            D;

            if (!$category) {
                if (!empty($categoryData['path'])) {
                    $categoryResource = $this->getContainer()->get(CategoryResource::class);
                    $category = $categoryResource->findCategoryByPath($categoryData['path'], true);

                    if (!$category) {
                        
Home | Imprint | This part of the site doesn't use cookies.