src/Entity/ProductOptionValue.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\ProductOptionValueRepository")
  8.  */
  9. class ProductOptionValue
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="bigint")
  15.      */
  16.     private $id;
  17.     
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $value;
  22.     
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity="App\Entity\ProductOption", inversedBy="productOptionValues")
  25.      * @ORM\JoinColumn(name="product_option_id", referencedColumnName="id", onDelete="SET NULL")
  26.      */
  27.     private $productOption;
  28.     /**
  29.      * @ORM\Column(type="integer")
  30.      */
  31.     private $price;
  32.     /**
  33.      * @ORM\ManyToMany(targetEntity="App\Entity\PurchaseItem", mappedBy="product_option_values")
  34.      */
  35.     private $purchase_items;
  36.     
  37.     
  38.     public function __construct ()
  39.     {
  40.         $this->value "";
  41.         $this->amount 0;
  42.         $this->purchase_items = new ArrayCollection();
  43.     }
  44.     public function getId()
  45.     {
  46.         return $this->id;
  47.     }
  48.     
  49.     public function getValue(): ?string
  50.     {
  51.         return $this->value;
  52.     }
  53.     public function setValue(string $value null): self
  54.     {
  55.         $this->value $value $value "";
  56.         
  57.         return $this;
  58.     }
  59.     
  60.     public function getProductOption(): ?ProductOption
  61.     {
  62.         return $this->productOption;
  63.     }
  64.     
  65.     public function setProductOption(?ProductOption $productOption null): self
  66.     {
  67.         $this->productOption $productOption;
  68.         
  69.         return $this;
  70.     }
  71.     
  72.     public function getPrice()
  73.     {
  74.         return $this->price;
  75.     }
  76.     
  77.     public function setPrice($price 0)
  78.     {
  79.         $this->price $price;
  80.         return $this;
  81.     }
  82.     public function getPurchaseItems (): Collection
  83.     {
  84.         return $this->purchase_items;
  85.     }
  86.     
  87.     public function addPurchaseItem (PurchaseItem $purchase_item)
  88.     {
  89.         if (!$this->purchase_items->contains($purchase_item)) {
  90.             $this->purchase_items[] = $purchase_item;
  91.             $purchase_item->addProductOptionValue($this);
  92.         }
  93.         return $this;
  94.     }
  95.     
  96.     public function removePurchaseItem (PurchaseItem $purchase_item): self
  97.     {
  98.         if ($this->purchase_items->contains($purchase_item)) {
  99.             $this->purchase_items->removeElement($purchase_item);
  100.             $purchase_item->removeProductOptionValue($this);
  101.         }
  102.         return $this;
  103.     }
  104.     
  105.     public function __toString ()
  106.     {
  107.         return $this->value $this->value '';
  108.     }
  109.     
  110. }