créer follow up des villes

This commit is contained in:
Tykayn 2025-06-29 14:50:46 +02:00 committed by tykayn
parent 10a984738f
commit 4b4a46c3f7
3 changed files with 166 additions and 0 deletions

108
src/Entity/CityFollowUp.php Normal file
View file

@ -0,0 +1,108 @@
<?php
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)]
class CityFollowUp
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column]
private ?float $measure = null;
#[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();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getMeasure(): ?float
{
return $this->measure;
}
public function setMeasure(float $measure): static
{
$this->measure = $measure;
return $this;
}
public function getDate(): ?\DateTime
{
return $this->date;
}
public function setDate(\DateTime $date): static
{
$this->date = $date;
return $this;
}
/**
* @return Collection<int, Stats>
*/
public function getStats(): Collection
{
return $this->stats;
}
public function addStat(Stats $stat): 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);
}
}
return $this;
}
}

View file

@ -98,6 +98,9 @@ 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;
public function getCTCurlBase(): ?string
{
$base = 'https://complete-tes-commerces.fr/';
@ -565,6 +568,18 @@ class Stats
return $this;
}
public function getCityFollowUps(): ?CityFollowUp
{
return $this->cityFollowUps;
}
public function setCityFollowUps(?CityFollowUp $cityFollowUps): static
{
$this->cityFollowUps = $cityFollowUps;
return $this;
}
}

View file

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\CityFollowUp;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<CityFollowUp>
*/
class CityFollowUpRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, CityFollowUp::class);
}
// /**
// * @return CityFollowUp[] Returns an array of CityFollowUp objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('c.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?CityFollowUp
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}