ajout stat hist

This commit is contained in:
Tykayn 2025-06-17 18:27:19 +02:00 committed by tykayn
parent 918527e15e
commit 7fb0c9c8c2
19 changed files with 695 additions and 314 deletions

View file

@ -59,6 +59,21 @@ class Stats
#[ORM\Column(type: Types::INTEGER, nullable: true)]
private ?int $population = null;
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
private ?int $siren = null;
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
private ?int $codeEpci = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $codesPostaux = null;
/**
* @var Collection<int, StatsHistory>
*/
#[ORM\OneToMany(targetEntity: StatsHistory::class, mappedBy: 'stats')]
private Collection $statsHistories;
// calcule le pourcentage de complétion de la zone
public function computeCompletionPercent(): ?int
{
@ -115,6 +130,7 @@ class Stats
public function __construct()
{
$this->places = new ArrayCollection();
$this->statsHistories = new ArrayCollection();
}
public function getId(): ?int
@ -270,6 +286,72 @@ class Stats
$this->population = $population;
return $this;
}
public function getSiren(): ?int
{
return $this->siren;
}
public function setSiren(?int $siren): static
{
$this->siren = $siren;
return $this;
}
public function getCodeEpci(): ?int
{
return $this->codeEpci;
}
public function setCodeEpci(?int $codeEpci): static
{
$this->codeEpci = $codeEpci;
return $this;
}
public function getCodesPostaux(): ?string
{
return $this->codesPostaux;
}
public function setCodesPostaux(?string $codesPostaux): static
{
$this->codesPostaux = $codesPostaux;
return $this;
}
/**
* @return Collection<int, StatsHistory>
*/
public function getStatsHistories(): Collection
{
return $this->statsHistories;
}
public function addStatsHistory(StatsHistory $statsHistory): static
{
if (!$this->statsHistories->contains($statsHistory)) {
$this->statsHistories->add($statsHistory);
$statsHistory->setStats($this);
}
return $this;
}
public function removeStatsHistory(StatsHistory $statsHistory): static
{
if ($this->statsHistories->removeElement($statsHistory)) {
// set the owning side to null (unless already changed)
if ($statsHistory->getStats() === $this) {
$statsHistory->setStats(null);
}
}
return $this;
}
}