<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\MatPremiereRepository")
*/
class MatPremiere
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Products", inversedBy="matPremieres")
*/
private $products;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Grade", mappedBy="mtPremiere")
*/
private $grades;
public function __construct()
{
$this->grades = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getProducts(): ?Products
{
return $this->products;
}
public function setProducts(?Products $products): self
{
$this->products = $products;
return $this;
}
/**
* @return Collection|Grade[]
*/
public function getGrades(): Collection
{
return $this->grades;
}
public function addGrade(Grade $grade): self
{
if (!$this->grades->contains($grade)) {
$this->grades[] = $grade;
$grade->setMtPremiere($this);
}
return $this;
}
public function removeGrade(Grade $grade): self
{
if ($this->grades->contains($grade)) {
$this->grades->removeElement($grade);
// set the owning side to null (unless already changed)
if ($grade->getMtPremiere() === $this) {
$grade->setMtPremiere(null);
}
}
return $this;
}
public function __toString()
{
return $this->name;
}
}