diff --git a/src/Entity/CityFollowUp.php b/src/Entity/CityFollowUp.php new file mode 100644 index 0000000..1eb3102 --- /dev/null +++ b/src/Entity/CityFollowUp.php @@ -0,0 +1,108 @@ + + */ + #[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 + */ + 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; + } +} diff --git a/src/Entity/Stats.php b/src/Entity/Stats.php index 27d69d7..b270468 100644 --- a/src/Entity/Stats.php +++ b/src/Entity/Stats.php @@ -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; + } } diff --git a/src/Repository/CityFollowUpRepository.php b/src/Repository/CityFollowUpRepository.php new file mode 100644 index 0000000..df0a522 --- /dev/null +++ b/src/Repository/CityFollowUpRepository.php @@ -0,0 +1,43 @@ + + */ +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() + // ; + // } +}