src/Entity/Reference.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ReferenceRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ReferenceRepository::class)
  10.  */
  11. class Reference
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      * @Groups({"brand_references", "stock_edit", "installation_edit"})
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      * @Groups({"brand_references", "stock_edit"})
  23.      */
  24.     private $name;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity=Brand::class, inversedBy="brand_references")
  27.      * @Groups({"installation_edit"})
  28.      */
  29.     private $brand;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=Stock::class, mappedBy="reference")
  32.      */
  33.     private $stocks;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=Type::class)
  36.      */
  37.     private $type;
  38.     /**
  39.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  40.      */
  41.     private $actualPrice;
  42.     /**
  43.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  44.      */
  45.     private $oldPrice;
  46.     /**
  47.      * @ORM\ManyToOne(targetEntity=Packaging::class, inversedBy="products")
  48.      */
  49.     private $packaging;
  50.     public function __construct()
  51.     {
  52.         $this->stocks = new ArrayCollection();
  53.     }
  54.     public function getId(): ?int
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function setId(): ?int
  59.     {
  60.         return $this->id;
  61.     }
  62.     public function getName(): ?string
  63.     {
  64.         return $this->name;
  65.     }
  66.     public function setName(string $name): self
  67.     {
  68.         $this->name $name;
  69.         return $this;
  70.     }
  71.     public function getBrand(): ?Brand
  72.     {
  73.         return $this->brand;
  74.     }
  75.     public function setBrand(?Brand $brand): self
  76.     {
  77.         $this->brand $brand;
  78.         return $this;
  79.     }
  80.     /**
  81.      * @return Collection<int, Stock>
  82.      */
  83.     public function getStocks(): Collection
  84.     {
  85.         return $this->stocks;
  86.     }
  87.     public function addStock(Stock $stock): self
  88.     {
  89.         if (!$this->stocks->contains($stock)) {
  90.             $this->stocks[] = $stock;
  91.             $stock->setReference($this);
  92.         }
  93.         return $this;
  94.     }
  95.     public function removeStock(Stock $stock): self
  96.     {
  97.         if ($this->stocks->removeElement($stock)) {
  98.             // set the owning side to null (unless already changed)
  99.             if ($stock->getReference() === $this) {
  100.                 $stock->setReference(null);
  101.             }
  102.         }
  103.         return $this;
  104.     }
  105.     public function getType(): ?Type
  106.     {
  107.         return $this->type;
  108.     }
  109.     public function setType(?Type $type): self
  110.     {
  111.         $this->type $type;
  112.         return $this;
  113.     }
  114.     public function getActualPrice(): ?string
  115.     {
  116.         return $this->actualPrice;
  117.     }
  118.     public function setActualPrice(?string $actualPrice): self
  119.     {
  120.         $this->actualPrice $actualPrice;
  121.         return $this;
  122.     }
  123.     public function getOldPrice(): ?string
  124.     {
  125.         return $this->oldPrice;
  126.     }
  127.     public function setOldPrice(?string $oldPrice): self
  128.     {
  129.         $this->oldPrice $oldPrice;
  130.         return $this;
  131.     }
  132.     public function getPackaging(): ?Packaging
  133.     {
  134.         return $this->packaging;
  135.     }
  136.     public function setPackaging(?Packaging $packaging): self
  137.     {
  138.         $this->packaging $packaging;
  139.         return $this;
  140.     }
  141. }