Set the current category for the collection.

@param \Magento\Catalog\Api\Data\CategoryInterface $category Current category.

@return \Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\FilterableAttribute\Category\Collection
509715
public function setCategory(\Magento\Catalog\Api\Data\CategoryInterface $category)
    {
        $this->category = $category;

        return $this;
    }
1210665
protected function prepareCategory(array &$category)
    {
        $this->setItemAlias($category, 'category', $this->alias);
        $this->setItemImages($category, 'category', $this->image);
        $this->setItemTranslation($category, 'category', $this->translation_entity);

        if (!empty($category['images'])) {
            foreach ($category['images'] as &$file) {
                $this->setItemTranslation($file, 'file', $this->translation_entity);
            }
        }
    }
130693
public function addCategory(CategoryInterface $category)
    {
        if (! $this->hasCategory($category)) {
            $this->categories->add($category);
        }

        return $this;
    }
369132
public function update(DocumentCategory $category)
    {
        $attributes = request()->validate(DocumentCategory::$rules, DocumentCategory::$messages);

        $category = $this->updateEntry($category, $attributes);

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

        return $this;
    }
583791
public function setParent(\Amulen\ClassificationBundle\Entity\Category $parent = null)
    {
        $this->parent = $parent;

        return $this;
    }
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;
    }
886692
public function addCategory(\Haven\CoreBundle\Entity\Category $categories)
    {
        $this->categories[] = $categories;
    
        return $this;
    }
1346002
protected function applyCategoryFilterToCollection(\Magento\Catalog\Api\Data\CategoryInterface $category)
    {
        $this->getLayer()->getProductCollection()->addCategoryFilter($category);

        return $this;
    }
368617
public function setAllowedCategories($categories)
    {
        if (is_string($categories)) {
            $categories = preg_split('/\s*,\s*/', $categories);
        }
        $this->allowedCategories = (array)$categories;
        return $this;
    }
1276308
public function setCategory($category)
    {
        $allowedValues = $this->getCategoryAllowableValues();
        if (!in_array($category, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'category', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['category'] = $category;

        return $this;
    }
440308
public function addCategorie(\Haven\CoreBundle\Entity\Category $categories)
    {
        $this->categories[] = $categories;
    
        return $this;
    }
176182
public function addCategory(CategoryInterface $category)
    {
        if (!$this
            ->categories
            ->contains($category)
        ) {
            $this
                ->categories
                ->add($category);
        }

        return $this;
    }
1056780
public static function createFromCategory(Category $category): self
    {
        $message = new self();
        $message->setId($category->getId());
        $message->setEnabled($category->isEnabled());

        foreach ($category->getTranslations() as $translation) {
            $transMessage = CategoryTranslationMessage::createFromCategoryTranslation($translation);

            $message->addTranslation($transMessage);
        }

        return $message;
    }
1321940
public function category(Category $category)
    {
        $this->_category = $category;

        $this->joinWith('categories');
        $this->andFilterWhere([$category::tableName().'.id' => $this->_category->id]);

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

        return $this;
    }
653207
public function addCategory(\Enhavo\Bundle\CategoryBundle\Entity\Category $category)
    {
        $category->setCollection($this);
        $this->categories[] = $category;

        return $this;
    }