diff --git a/api-platform/api/README.md b/api-platform/api/README.md index d0edd4cfc66a3f2208dbda4be65593e9273a1899..a40bfd2170e69cd6200e063c2dac62d23f67a09a 100644 --- a/api-platform/api/README.md +++ b/api-platform/api/README.md @@ -3,3 +3,18 @@ The API will be here. Refer to the [Getting Started Guide](https://api-platform.com/docs/distribution) for more information. + +Entities/Fixtures + +Commune : +- Num Commune : Col 3 +- Nom Commune : Col 10 +- Département : Col 1 +- Région : à calculer je crois + +Données : +- Commune : Col 3 +- Année : fichier +- Type de taxe : TFPNB | TFPB | TH | CFE +- Taux : Cols 13 | 68 | 175 | 332 +- Volume Collecté : 14 | 69 | 176 | 333 \ No newline at end of file diff --git a/api-platform/api/src/Entity/Commune.php b/api-platform/api/src/Entity/Commune.php new file mode 100644 index 0000000000000000000000000000000000000000..addaa553cec69460adb63b11aedad76e59c33a20 --- /dev/null +++ b/api-platform/api/src/Entity/Commune.php @@ -0,0 +1,103 @@ + + */ + #[ORM\OneToMany(targetEntity: Taxe::class, mappedBy: 'commune', orphanRemoval: true)] + private Collection $taxes; + + public function __construct() + { + $this->taxes = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getNom(): ?string + { + return $this->nom; + } + + public function setNom(string $nom): static + { + $this->nom = $nom; + + return $this; + } + + public function getDepartement(): ?Departement + { + return $this->departement; + } + + public function setDepartement(?Departement $departement): static + { + $this->departement = $departement; + + return $this; + } + + /** + * @return Collection + */ + public function getTaxes(): Collection + { + return $this->taxes; + } + + public function addTax(Taxe $tax): static + { + if (!$this->taxes->contains($tax)) { + $this->taxes->add($tax); + $tax->setCommune($this); + } + + return $this; + } + + public function removeTax(Taxe $tax): static + { + if ($this->taxes->removeElement($tax)) { + // set the owning side to null (unless already changed) + if ($tax->getCommune() === $this) { + $tax->setCommune(null); + } + } + + return $this; + } +} diff --git a/api-platform/api/src/Entity/Departement.php b/api-platform/api/src/Entity/Departement.php new file mode 100644 index 0000000000000000000000000000000000000000..6c40eda06711f1ad9f8442bf6a64a23c3e1f6fee --- /dev/null +++ b/api-platform/api/src/Entity/Departement.php @@ -0,0 +1,96 @@ + + */ + #[ORM\OneToMany(targetEntity: Commune::class, mappedBy: 'departement', orphanRemoval: true)] + private Collection $communes; + + public function __construct() + { + $this->communes = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function getCode(): ?int + { + return $this->code; + } + + public function setCode(int $code): static + { + $this->code = $code; + + return $this; + } + + public function getRegion(): ?Region + { + return $this->region; + } + + public function setRegion(?Region $region): static + { + $this->region = $region; + + return $this; + } + + /** + * @return Collection + */ + public function getCommunes(): Collection + { + return $this->communes; + } + + public function addCommune(Commune $commune): static + { + if (!$this->communes->contains($commune)) { + $this->communes->add($commune); + $commune->setDepartement($this); + } + + return $this; + } + + public function removeCommune(Commune $commune): static + { + if ($this->communes->removeElement($commune)) { + // set the owning side to null (unless already changed) + if ($commune->getDepartement() === $this) { + $commune->setDepartement(null); + } + } + + return $this; + } +} diff --git a/api-platform/api/src/Entity/Greeting.php b/api-platform/api/src/Entity/Greeting.php deleted file mode 100644 index ba4c64092449df9da21f2adf309f343a48aff92e..0000000000000000000000000000000000000000 --- a/api-platform/api/src/Entity/Greeting.php +++ /dev/null @@ -1,35 +0,0 @@ -id; - } -} diff --git a/api-platform/api/src/Entity/Region.php b/api-platform/api/src/Entity/Region.php new file mode 100644 index 0000000000000000000000000000000000000000..617cb3a4fd88f3fc2d9b33b3f439a70b0de1414b --- /dev/null +++ b/api-platform/api/src/Entity/Region.php @@ -0,0 +1,80 @@ + + */ + #[ORM\OneToMany(targetEntity: Departement::class, mappedBy: 'region', orphanRemoval: true)] + private Collection $departements; + + public function __construct() + { + $this->departements = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function getNom(): ?string + { + return $this->nom; + } + + public function setNom(string $nom): static + { + $this->nom = $nom; + + return $this; + } + + /** + * @return Collection + */ + public function getDepartements(): Collection + { + return $this->departements; + } + + public function addDepartement(Departement $departement): static + { + if (!$this->departements->contains($departement)) { + $this->departements->add($departement); + $departement->setRegion($this); + } + + return $this; + } + + public function removeDepartement(Departement $departement): static + { + if ($this->departements->removeElement($departement)) { + // set the owning side to null (unless already changed) + if ($departement->getRegion() === $this) { + $departement->setRegion(null); + } + } + + return $this; + } +} diff --git a/api-platform/api/src/Entity/Taxe.php b/api-platform/api/src/Entity/Taxe.php new file mode 100644 index 0000000000000000000000000000000000000000..bba17e487609d1cd26d57dce2d0efab52b4e2194 --- /dev/null +++ b/api-platform/api/src/Entity/Taxe.php @@ -0,0 +1,99 @@ +id; + } + + public function getCommune(): ?Commune + { + return $this->commune; + } + + public function setCommune(?Commune $commune): static + { + $this->commune = $commune; + + return $this; + } + + public function getAnnee(): ?int + { + return $this->annee; + } + + public function setAnnee(int $annee): static + { + $this->annee = $annee; + + return $this; + } + + public function getType(): ?TypeTaxe + { + return $this->type; + } + + public function setType(?TypeTaxe $type): static + { + $this->type = $type; + + return $this; + } + + public function getTaux(): ?float + { + return $this->taux; + } + + public function setTaux(float $taux): static + { + $this->taux = $taux; + + return $this; + } + + public function getVolume(): ?float + { + return $this->volume; + } + + public function setVolume(float $volume): static + { + $this->volume = $volume; + + return $this; + } +} diff --git a/api-platform/api/src/Entity/TypeTaxe.php b/api-platform/api/src/Entity/TypeTaxe.php new file mode 100644 index 0000000000000000000000000000000000000000..02f89b8412e7555ec54718c4cb80d9a6edccf137 --- /dev/null +++ b/api-platform/api/src/Entity/TypeTaxe.php @@ -0,0 +1,95 @@ + + */ + #[ORM\OneToMany(targetEntity: Taxe::class, mappedBy: 'type', orphanRemoval: true)] + private Collection $taxes; + + public function __construct() + { + $this->taxes = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function getCode(): ?string + { + return $this->code; + } + + public function setCode(string $code): static + { + $this->code = $code; + + return $this; + } + + public function getLabel(): ?string + { + return $this->label; + } + + public function setLabel(string $label): static + { + $this->label = $label; + + return $this; + } + + /** + * @return Collection + */ + public function getTaxes(): Collection + { + return $this->taxes; + } + + public function addTax(Taxe $tax): static + { + if (!$this->taxes->contains($tax)) { + $this->taxes->add($tax); + $tax->setType($this); + } + + return $this; + } + + public function removeTax(Taxe $tax): static + { + if ($this->taxes->removeElement($tax)) { + // set the owning side to null (unless already changed) + if ($tax->getType() === $this) { + $tax->setType(null); + } + } + + return $this; + } +} diff --git a/api-platform/api/src/Repository/CommuneRepository.php b/api-platform/api/src/Repository/CommuneRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..393ffd5a31e4e90de64cae11f395d56aae9a91ed --- /dev/null +++ b/api-platform/api/src/Repository/CommuneRepository.php @@ -0,0 +1,43 @@ + + */ +class CommuneRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Commune::class); + } + +// /** +// * @return Commune[] Returns an array of Commune 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): ?Commune +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/api-platform/api/src/Repository/DepartementRepository.php b/api-platform/api/src/Repository/DepartementRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..2cd358112acaca5416eb2866d30bb77847aa948f --- /dev/null +++ b/api-platform/api/src/Repository/DepartementRepository.php @@ -0,0 +1,43 @@ + + */ +class DepartementRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Departement::class); + } + + // /** + // * @return Departement[] Returns an array of Departement objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('d') + // ->andWhere('d.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('d.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?Departement + // { + // return $this->createQueryBuilder('d') + // ->andWhere('d.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/api-platform/api/src/Repository/RegionRepository.php b/api-platform/api/src/Repository/RegionRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..83e6a387e495aa36c86d5df1f0932f0bb7f19fe1 --- /dev/null +++ b/api-platform/api/src/Repository/RegionRepository.php @@ -0,0 +1,43 @@ + + */ +class RegionRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Region::class); + } + + // /** + // * @return Region[] Returns an array of Region objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('r') + // ->andWhere('r.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('r.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?Region + // { + // return $this->createQueryBuilder('r') + // ->andWhere('r.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/api-platform/api/src/Repository/TaxeRepository.php b/api-platform/api/src/Repository/TaxeRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..9218441a371b9be63e014fe7ecd4f19e0832a7cf --- /dev/null +++ b/api-platform/api/src/Repository/TaxeRepository.php @@ -0,0 +1,43 @@ + + */ +class TaxeRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Taxe::class); + } + +// /** +// * @return Taxe[] Returns an array of Taxe objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('t') +// ->andWhere('t.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('t.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Taxe +// { +// return $this->createQueryBuilder('t') +// ->andWhere('t.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/api-platform/api/src/Repository/TypeTaxeRepository.php b/api-platform/api/src/Repository/TypeTaxeRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..d42be41e10dd5070bb29bde1ddc450e1922f2314 --- /dev/null +++ b/api-platform/api/src/Repository/TypeTaxeRepository.php @@ -0,0 +1,43 @@ + + */ +class TypeTaxeRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, TypeTaxe::class); + } + + // /** + // * @return TypeTaxe[] Returns an array of TypeTaxe objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('t') + // ->andWhere('t.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('t.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?TypeTaxe + // { + // return $this->createQueryBuilder('t') + // ->andWhere('t.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +}