Add category.

@param CategoryInterface $category Category

@return $this Self object
176182
public function addCategory(CategoryInterface $category)
    {
        if (!$this
            ->categories
            ->contains($category)
        ) {
            $this
                ->categories
                ->add($category);
        }

        return $this;
    }
115308
public function addChild(\Octopouce\AdminBundle\Entity\Category $child)
    {
        $this->childs[] = $child;

        return $this;
    }
946032
static function updateCategory($category)
    {
        // Update the category thread and post counts
        $threads = $category->threads()->where('deleted_at', null)->get();
        $category->thread_count = $threads->count();

        $postCount = 0;
        foreach ($threads as $thread) {
            $postCount += $thread->posts->count();
        }

        $category->post_count = $postCount;
        $category->saveWithoutTouch();
    }
795977
public function make(ICategory $category)
    {
        //$category->setContent($this->view->make($category->getLayoutViewPath(), compact('category'))->render());
        $category->setContent($this->view->make(\OogleeBConfig::get('config.category_view.view'), compact('category'))->render());
    }
199791
public function setCategory($category)
    {
        self::writeFullTag(
            $category,
            'category',
            true,
            'video:category',
            $this->validator,
            'validateCategory',
            $this->exception,
            'Provided category value is not a valid.'
        );

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

        return $this;
    }
87340
public function setCategory(\HarvestCloud\CoreBundle\Entity\Category $category)
    {
        $this->category = $category;

        return $this;
    }
994662
public function setCategories($categories)
    {
        foreach ($categories as $key => $name) {
            $this->_categories[$key] = $name;
        }
    }
1369526
public function category($category = null)
  {
    if (null === $category)
    {
      return isset($this->requestConfig['category']) ? $this->requestConfig['category'] : null;
    }

    $this->requestConfig['category'] = $category;

    return $this;
  }
394644
private function addVirtualCategoryData(CategoryInterface $category)
    {
        $isVirtualCategory = (bool) $this->getRequest()->getParam('is_virtual_category');
        $category->setIsVirtualCategory($isVirtualCategory);

        if ($isVirtualCategory) {
            $category->getVirtualRule()->loadPost($this->getRequest()->getParam('virtual_rule', []));
            $category->setVirtualCategoryRoot($this->getRequest()->getParam('virtual_category_root', null));
        }

        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;
    }
870824
public function addChild(Category $category): Category
    {
        $this->children->add($category);

        if ($category->getParent() !== $this) {
            $category->setParent($this);
        }

        return $this;
    }
509715
public function setCategory(\Magento\Catalog\Api\Data\CategoryInterface $category)
    {
        $this->category = $category;

        return $this;
    }
883143
public function addCategory($category)
    {
        if (!($category instanceof Category)) {
            $category = new Category($category);
        }
        $this->categories[] = $category;
    }
658853
public function addParentCategory(CategoryInterface $category): CategoryInterface
    {
        if (!$this->hasParentCategory($category)) {
            $this->parentCategories->add($category);
        }

        return $this;
    }
157150
public function prune($category = null)
    {
        if ($category) {
            $this->addUsingAlias(CategoryTableMap::COL_ID, $category->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }
107754
public function addCategory(array $category)
    {
        if (empty($category['term'])) {
            /**
             * @see Zend_Feed_Builder_Exception
             */
            require_once 'Zend/Feed/Builder/Exception.php';
            throw new Zend_Feed_Builder_Exception("you have to define the name of the category");
        }

        if (!$this->offsetExists('category')) {
            $categories = array($category);
        } else {
            $categories = $this->offsetGet('category');
            $categories[] = $category;
        }
        $this->offsetSet('category', $categories);
        return $this;
    }