<?php
namespace App\Entity;
use App\Repository\AnneeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=AnneeRepository::class)
*/
class Annee
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="date")
*/
private $date;
/**
* @ORM\OneToMany(targetEntity=Zone::class, mappedBy="annee")
*/
private $zones;
/**
* @ORM\OneToMany(targetEntity=ZoneDepartementsPoids::class, mappedBy="annee")
*/
private $zoneDepartementsPoids;
public function __construct()
{
$this->zones = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
/**
* @return Collection<int, Zone>
*/
public function getZones(): Collection
{
return $this->zones;
}
public function addZone(Zone $zone): self
{
if (!$this->zones->contains($zone)) {
$this->zones[] = $zone;
$zone->setAnnee($this);
}
return $this;
}
public function removeZone(Zone $zone): self
{
if ($this->zones->removeElement($zone)) {
// set the owning side to null (unless already changed)
if ($zone->getAnnee() === $this) {
$zone->setAnnee(null);
}
}
return $this;
}
}