mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-09 17:02:46 +02:00
follow up graphs
This commit is contained in:
parent
4b4a46c3f7
commit
ab1b9a9d3d
11 changed files with 580 additions and 41 deletions
|
@ -3,8 +3,6 @@
|
|||
namespace App\Entity;
|
||||
|
||||
use App\Repository\CityFollowUpRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: CityFollowUpRepository::class)]
|
||||
|
@ -24,16 +22,8 @@ class CityFollowUp
|
|||
#[ORM\Column]
|
||||
private ?\DateTime $date = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Stats>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Stats::class, mappedBy: 'cityFollowUps')]
|
||||
private Collection $stats;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->stats = new ArrayCollection();
|
||||
}
|
||||
#[ORM\ManyToOne(targetEntity: Stats::class, inversedBy: 'cityFollowUps')]
|
||||
private ?Stats $stats = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
|
@ -76,33 +66,14 @@ class CityFollowUp
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Stats>
|
||||
*/
|
||||
public function getStats(): Collection
|
||||
public function getStats(): ?Stats
|
||||
{
|
||||
return $this->stats;
|
||||
}
|
||||
|
||||
public function addStat(Stats $stat): static
|
||||
public function setStats(?Stats $stats): static
|
||||
{
|
||||
if (!$this->stats->contains($stat)) {
|
||||
$this->stats->add($stat);
|
||||
$stat->setCityFollowUps($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeStat(Stats $stat): static
|
||||
{
|
||||
if ($this->stats->removeElement($stat)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($stat->getCityFollowUps() === $this) {
|
||||
$stat->setCityFollowUps(null);
|
||||
}
|
||||
}
|
||||
|
||||
$this->stats = $stats;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,8 +98,11 @@ class Stats
|
|||
#[ORM\Column(type: Types::DECIMAL, precision: 15, scale: 2, nullable: true)]
|
||||
private ?string $budget_annuel = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'stats')]
|
||||
private ?CityFollowUp $cityFollowUps = null;
|
||||
/**
|
||||
* @var Collection<int, CityFollowUp>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'stats', targetEntity: CityFollowUp::class, cascade: ['persist', 'remove'])]
|
||||
private Collection $cityFollowUps;
|
||||
|
||||
public function getCTCurlBase(): ?string
|
||||
{
|
||||
|
@ -251,6 +254,7 @@ class Stats
|
|||
{
|
||||
$this->places = new ArrayCollection();
|
||||
$this->statsHistories = new ArrayCollection();
|
||||
$this->cityFollowUps = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
|
@ -569,15 +573,30 @@ class Stats
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getCityFollowUps(): ?CityFollowUp
|
||||
/**
|
||||
* @return Collection<int, CityFollowUp>
|
||||
*/
|
||||
public function getCityFollowUps(): Collection
|
||||
{
|
||||
return $this->cityFollowUps;
|
||||
}
|
||||
|
||||
public function setCityFollowUps(?CityFollowUp $cityFollowUps): static
|
||||
public function addCityFollowUp(CityFollowUp $cityFollowUp): static
|
||||
{
|
||||
$this->cityFollowUps = $cityFollowUps;
|
||||
if (!$this->cityFollowUps->contains($cityFollowUp)) {
|
||||
$this->cityFollowUps->add($cityFollowUp);
|
||||
$cityFollowUp->setStats($this);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCityFollowUp(CityFollowUp $cityFollowUp): static
|
||||
{
|
||||
if ($this->cityFollowUps->removeElement($cityFollowUp)) {
|
||||
if ($cityFollowUp->getStats() === $this) {
|
||||
$cityFollowUp->setStats(null);
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue