示例#1
0
 /**
  * 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;
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function hasProduct(Product $product)
 {
     return $this->products->contains($product);
 }
示例#3
0
 /**
  * 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;
     }
 }
示例#4
0
 /**
  * @param Product $product
  *
  * @return $this
  */
 public function removeProduct(Product $product)
 {
     if ($this->products->contains($product)) {
         $this->products->removeElement($product);
     }
     return $this;
 }