mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-09 17:02:46 +02:00
ajout stat hist
This commit is contained in:
parent
918527e15e
commit
7fb0c9c8c2
19 changed files with 695 additions and 314 deletions
|
@ -16,9 +16,6 @@ class History
|
|||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
|
||||
|
||||
|
||||
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
|
||||
private ?int $completion_percent = null;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
98
src/Entity/StatsHistory.php
Normal file
98
src/Entity/StatsHistory.php
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\StatsHistoryRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: StatsHistoryRepository::class)]
|
||||
class StatsHistory
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $places_count = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $emails_count = null;
|
||||
|
||||
#[ORM\Column(type: Types::SMALLFLOAT, nullable: true)]
|
||||
private ?float $completion_percent = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $emails_sent = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'statsHistories')]
|
||||
private ?Stats $stats = null;
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getPlacesCount(): ?int
|
||||
{
|
||||
return $this->places_count;
|
||||
}
|
||||
|
||||
public function setPlacesCount(?int $places_count): static
|
||||
{
|
||||
$this->places_count = $places_count;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEmailsCount(): ?int
|
||||
{
|
||||
return $this->emails_count;
|
||||
}
|
||||
|
||||
public function setEmailsCount(?int $emails_count): static
|
||||
{
|
||||
$this->emails_count = $emails_count;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCompletionPercent(): ?float
|
||||
{
|
||||
return $this->completion_percent;
|
||||
}
|
||||
|
||||
public function setCompletionPercent(?float $completion_percent): static
|
||||
{
|
||||
$this->completion_percent = $completion_percent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEmailsSent(): ?int
|
||||
{
|
||||
return $this->emails_sent;
|
||||
}
|
||||
|
||||
public function setEmailsSent(?int $emails_sent): static
|
||||
{
|
||||
$this->emails_sent = $emails_sent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStats(): ?Stats
|
||||
{
|
||||
return $this->stats;
|
||||
}
|
||||
|
||||
public function setStats(?Stats $stats): static
|
||||
{
|
||||
$this->stats = $stats;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue