/** * Remove item * * @param Product $item * * @return Product */ public function removeProduct(Product $item) { if ($this->products->contains($item)) { $this->products->removeElement($item); $item->setVariant(null); } return $this; }
/** * {@inheritdoc} */ public function hasProduct(Product $product) { return $this->products->contains($product); }
/** * Add a product in the category. * * @param $product Product The product to associate */ public function addProduct($product) { if (!$this->products->contains($product)) { $this->products[] = $product; } }
/** * @param Product $product * * @return $this */ public function removeProduct(Product $product) { if ($this->products->contains($product)) { $this->products->removeElement($product); } return $this; }