/** * @param \Category $category * @param bool $crossLinking */ public function setCategory(Category $category, $crossLinking = true) { if ($this->category) { $this->category->removeProduct($this, false); } $this->category = $category; if ($crossLinking && $category) { $category->addProduct($this, false); } }