<?php
namespace App\Entity;
use App\Repository\RegionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=RegionRepository::class)
*/
class Region
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $nom;
/**
* @ORM\OneToMany(targetEntity=Cuvee::class, mappedBy="region")
*/
private $cuvees;
public function __construct()
{
$this->cuvees = new ArrayCollection();
}
public function __toString()
{
return $this->nom;
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
/**
* @return Collection<int, Cuvee>
*/
public function getCuvees(): Collection
{
return $this->cuvees;
}
public function addCuvee(Cuvee $cuvee): self
{
if (!$this->cuvees->contains($cuvee)) {
$this->cuvees[] = $cuvee;
$cuvee->setRegion($this);
}
return $this;
}
public function removeCuvee(Cuvee $cuvee): self
{
if ($this->cuvees->removeElement($cuvee)) {
// set the owning side to null (unless already changed)
if ($cuvee->getRegion() === $this) {
$cuvee->setRegion(null);
}
}
return $this;
}
}