src/Entity/MatPremiere.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\MatPremiereRepository")
  8.  */
  9. class MatPremiere
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255)
  19.      */
  20.     private $name;
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity="App\Entity\Products", inversedBy="matPremieres")
  23.      */
  24.     private $products;
  25.     /**
  26.      * @ORM\OneToMany(targetEntity="App\Entity\Grade", mappedBy="mtPremiere")
  27.      */
  28.     private $grades;
  29.     public function __construct()
  30.     {
  31.         $this->grades = new ArrayCollection();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getName(): ?string
  38.     {
  39.         return $this->name;
  40.     }
  41.     public function setName(string $name): self
  42.     {
  43.         $this->name $name;
  44.         return $this;
  45.     }
  46.     public function getProducts(): ?Products
  47.     {
  48.         return $this->products;
  49.     }
  50.     public function setProducts(?Products $products): self
  51.     {
  52.         $this->products $products;
  53.         return $this;
  54.     }
  55.     /**
  56.      * @return Collection|Grade[]
  57.      */
  58.     public function getGrades(): Collection
  59.     {
  60.         return $this->grades;
  61.     }
  62.     public function addGrade(Grade $grade): self
  63.     {
  64.         if (!$this->grades->contains($grade)) {
  65.             $this->grades[] = $grade;
  66.             $grade->setMtPremiere($this);
  67.         }
  68.         return $this;
  69.     }
  70.     public function removeGrade(Grade $grade): self
  71.     {
  72.         if ($this->grades->contains($grade)) {
  73.             $this->grades->removeElement($grade);
  74.             // set the owning side to null (unless already changed)
  75.             if ($grade->getMtPremiere() === $this) {
  76.                 $grade->setMtPremiere(null);
  77.             }
  78.         }
  79.         return $this;
  80.     }
  81.     public function __toString()
  82.     {
  83.         return $this->name;
  84.     }
  85. }