@param CategoryInterface $category

@return CategoryInterface
164549
public function save(CategoryInterface $category): CategoryInterface
    {
        $data = $this->serializer()->serialize($category);

        if ($category->getId() !== 0) {
            $this->shopware()
                 ->put('/api/categories/'.(string)$category->getId(), [], $data);
        } else {
            $response = $this->shopware()->post('/api/categories', [], $data);
            $data     = json_decode((string)$response->getBody(), true);
            $category->setId((int)$data['data']['id']);
        }

        return $category;
    }
269394
public function addChild(CategoryInterface $child)
    {
        $child->setParent($this);
        $this->children[] = $child;

        return $this;
    }
27550
private function setSortedProducts(CategoryInterface $category)
    {
        $productPositions = $this->getRequest()->getParam('product_position', []);
        $category->setSortedProductIds(array_keys($productPositions));

        return $this;
    }
1300904
public function findCategory(CategoryInterface $searchCategory): ?CategoryInterface
    {
        foreach ($this->categories as $category) {
            if($category->getNumber() === $searchCategory->getNumber()) {
                return $category;
            }
        }

        return null;
    }
649625
private function addSelectedProducts(CategoryInterface $category)
    {
        $selectedProducts = $this->getRequest()->getParam('selected_products', []);

        $addedProducts = isset($selectedProducts['added_products']) ? $selectedProducts['added_products'] : [];
        $category->setAddedProductIds($addedProducts);

        $deletedProducts = isset($selectedProducts['deleted_products']) ? $selectedProducts['deleted_products'] : [];
        $category->setDeletedProductIds($deletedProducts);

        return $this;
    }
539287
public function setCategory($category)
    {
        $properties = $this->getProperty();
        $properties['category'] = (array) $category;
        $this->getConfig()->setSection('bundle', $properties, true);

        return $this;
    }
886692
public function addCategory(\Haven\CoreBundle\Entity\Category $categories)
    {
        $this->categories[] = $categories;
    
        return $this;
    }
440308
public function addCategorie(\Haven\CoreBundle\Entity\Category $categories)
    {
        $this->categories[] = $categories;
    
        return $this;
    }
743542
public function single($category)
    {
        $entry = new Entry($category);

        $entry
            ->field('id')
            ->field('label')
            ->field('slug')
            ->field('parent')
            ->field('position')
        ;

        return $entry->toArray();
    }
180361
public function addCategory(\Amulen\ClassificationBundle\Entity\Category $category)
    {
        $this->categories[] = $category;

        return $this;
    }
1123933
public function getRootCategoryWithChildren(CategoryInterface $category)
    {
        if (null === $category->getContext()) {
            throw new \RuntimeException('Context cannot be null');
        }
        if (null !== $category->getParent()) {
            throw new \RuntimeException('Method can be called only for root categories');
        }
        $context = $this->getContext($category->getContext());

        $this->loadCategories($context);

        foreach ($this->categories[$context->getId()] as $contextRootCategory) {
            if ($category->getId() === $contextRootCategory->getId()) {
                return $contextRootCategory;
            }
        }

        throw new \RuntimeException('Category does not exist');
    }
1337260
private function getCategorySearchQuery(CategoryInterface $category)
    {
        $virtualRule = $category->getVirtualRule();
        if (!($virtualRule instanceof VirtualRuleInterface)) {
            return $this->loadVirtualRule($category)->getCategorySearchQuery($category);
        }

        return $this->helper->loadUsingCache($category, 'getCategorySearchQuery');
    }
556406
public function addCategory($category)
    {
        if ( ! in_array($category, (array)$this->categories)) {
            $this->categories[] = $category;
        }

        return $this;
    }
1061974
public static function getInstance($category = self::CATEGORY_DEFAULT)
    {
        if (!isset(self::$instances[$category])) {
            self::$instances[$category] = new static($category);
        }
        return self::$instances[$category];
    }
1346002
protected function applyCategoryFilterToCollection(\Magento\Catalog\Api\Data\CategoryInterface $category)
    {
        $this->getLayer()->getProductCollection()->addCategoryFilter($category);

        return $this;
    }
681276
public function setCategory(\Innova\LexiconBundle\Entity\Category $category = null)
    {
        $this->category = $category;

        return $this;
    }
1212391
public function update(CategoryRequest $request, Category $category)
    {
        $category->update($request->all());
        return new CategoryResource($category);
    }