From 2d1dd4cb0ecc31fd115eb8d47ef4d97ae6c13c11 Mon Sep 17 00:00:00 2001 From: Tom Rouillon <tom.rouillon3@etu.univ-lorraine.fr> Date: Wed, 17 Jan 2024 09:57:14 +0100 Subject: [PATCH] New entities --- .../src/Controller/AdherentController.php | 18 ++ Back_end/src/Entity/Adherent.php | 283 ++++++++++++++++++ .../src/Repository/AdherentRepository.php | 48 +++ Back_end/templates/adherent/index.html.twig | 20 ++ 4 files changed, 369 insertions(+) create mode 100644 Back_end/src/Controller/AdherentController.php create mode 100644 Back_end/src/Entity/Adherent.php create mode 100644 Back_end/src/Repository/AdherentRepository.php create mode 100644 Back_end/templates/adherent/index.html.twig diff --git a/Back_end/src/Controller/AdherentController.php b/Back_end/src/Controller/AdherentController.php new file mode 100644 index 0000000..05afea7 --- /dev/null +++ b/Back_end/src/Controller/AdherentController.php @@ -0,0 +1,18 @@ +<?php + +namespace App\Controller; + +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; + +class AdherentController extends AbstractController +{ + #[Route('/adherent', name: 'app_adherent')] + public function index(): Response + { + return $this->render('adherent/index.html.twig', [ + 'controller_name' => 'AdherentController', + ]); + } +} diff --git a/Back_end/src/Entity/Adherent.php b/Back_end/src/Entity/Adherent.php new file mode 100644 index 0000000..8cf7bc6 --- /dev/null +++ b/Back_end/src/Entity/Adherent.php @@ -0,0 +1,283 @@ +<?php + +namespace App\Entity; + +use App\Repository\AdherentRepository; +use Doctrine\DBAL\Types\Types; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: AdherentRepository::class)] +class Adherent +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column(length: 100)] + private ?string $raisonSociale = null; + + #[ORM\Column(length: 10)] + private ?string $civilite = null; + + #[ORM\Column(length: 45, nullable: true)] + private ?string $nom = null; + + #[ORM\Column(length: 45, nullable: true)] + private ?string $prenom = null; + + #[ORM\Column(length: 100, nullable: true)] + private ?string $adresse = null; + + #[ORM\Column(length: 10, nullable: true)] + private ?string $codePostal = null; + + #[ORM\Column(length: 45, nullable: true)] + private ?string $ville = null; + + #[ORM\Column(length: 20, nullable: true)] + private ?string $telephone = null; + + #[ORM\Column(length: 20, nullable: true)] + private ?string $telephone2 = null; + + #[ORM\Column(length: 20, nullable: true)] + private ?string $telephone3 = null; + + #[ORM\Column(length: 45, nullable: true)] + private ?string $mail = null; + + #[ORM\Column(length: 45, nullable: true)] + private ?string $profession = null; + + #[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)] + private ?\DateTimeInterface $dateNaissance = null; + + #[ORM\Column(length: 200, nullable: true)] + private ?string $password = null; + + #[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)] + private ?\DateTimeInterface $datePremiereAdhesion = null; + + #[ORM\Column(nullable: true)] + private ?bool $dispenseAdhesion = null; + + #[ORM\Column(nullable: true)] + private ?bool $adhesionAJour = null; + + public function getId(): ?int + { + return $this->id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getRaisonSociale(): ?string + { + return $this->raisonSociale; + } + + public function setRaisonSociale(string $raisonSociale): static + { + $this->raisonSociale = $raisonSociale; + + return $this; + } + + public function getCivilite(): ?string + { + return $this->civilite; + } + + public function setCivilite(string $civilite): static + { + $this->civilite = $civilite; + + return $this; + } + + public function getNom(): ?string + { + return $this->nom; + } + + public function setNom(?string $nom): static + { + $this->nom = $nom; + + return $this; + } + + public function getPrenom(): ?string + { + return $this->prenom; + } + + public function setPrenom(?string $prenom): static + { + $this->prenom = $prenom; + + return $this; + } + + public function getAdresse(): ?string + { + return $this->adresse; + } + + public function setAdresse(?string $adresse): static + { + $this->adresse = $adresse; + + return $this; + } + + public function getCodePostal(): ?string + { + return $this->codePostal; + } + + public function setCodePostal(?string $codePostal): static + { + $this->codePostal = $codePostal; + + return $this; + } + + public function getVille(): ?string + { + return $this->ville; + } + + public function setVille(?string $ville): static + { + $this->ville = $ville; + + return $this; + } + + public function getTelephone(): ?string + { + return $this->telephone; + } + + public function setTelephone(?string $telephone): static + { + $this->telephone = $telephone; + + return $this; + } + + public function getTelephone2(): ?string + { + return $this->telephone2; + } + + public function setTelephone2(?string $telephone2): static + { + $this->telephone2 = $telephone2; + + return $this; + } + + public function getTelephone3(): ?string + { + return $this->telephone3; + } + + public function setTelephone3(?string $telephone3): static + { + $this->telephone3 = $telephone3; + + return $this; + } + + public function getMail(): ?string + { + return $this->mail; + } + + public function setMail(?string $mail): static + { + $this->mail = $mail; + + return $this; + } + + public function getProfession(): ?string + { + return $this->profession; + } + + public function setProfession(?string $profession): static + { + $this->profession = $profession; + + return $this; + } + + public function getDateNaissance(): ?\DateTimeInterface + { + return $this->dateNaissance; + } + + public function setDateNaissance(?\DateTimeInterface $dateNaissance): static + { + $this->dateNaissance = $dateNaissance; + + return $this; + } + + public function getPassword(): ?string + { + return $this->password; + } + + public function setPassword(?string $password): static + { + $this->password = $password; + + return $this; + } + + public function getDatePremiereAdhesion(): ?\DateTimeInterface + { + return $this->datePremiereAdhesion; + } + + public function setDatePremiereAdhesion(?\DateTimeInterface $datePremiereAdhesion): static + { + $this->datePremiereAdhesion = $datePremiereAdhesion; + + return $this; + } + + public function isDispenseAdhesion(): ?bool + { + return $this->dispenseAdhesion; + } + + public function setDispenseAdhesion(?bool $dispenseAdhesion): static + { + $this->dispenseAdhesion = $dispenseAdhesion; + + return $this; + } + + public function isAdhesionAJour(): ?bool + { + return $this->adhesionAJour; + } + + public function setAdhesionAJour(?bool $adhesionAJour): static + { + $this->adhesionAJour = $adhesionAJour; + + return $this; + } +} diff --git a/Back_end/src/Repository/AdherentRepository.php b/Back_end/src/Repository/AdherentRepository.php new file mode 100644 index 0000000..b33bb8c --- /dev/null +++ b/Back_end/src/Repository/AdherentRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\Adherent; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<Adherent> + * + * @method Adherent|null find($id, $lockMode = null, $lockVersion = null) + * @method Adherent|null findOneBy(array $criteria, array $orderBy = null) + * @method Adherent[] findAll() + * @method Adherent[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class AdherentRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Adherent::class); + } + +// /** +// * @return Adherent[] Returns an array of Adherent objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('a') +// ->andWhere('a.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('a.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Adherent +// { +// return $this->createQueryBuilder('a') +// ->andWhere('a.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/Back_end/templates/adherent/index.html.twig b/Back_end/templates/adherent/index.html.twig new file mode 100644 index 0000000..f27e696 --- /dev/null +++ b/Back_end/templates/adherent/index.html.twig @@ -0,0 +1,20 @@ +{% extends 'base.html.twig' %} + +{% block title %}Hello AdherentController!{% endblock %} + +{% block body %} +<style> + .example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; } + .example-wrapper code { background: #F5F5F5; padding: 2px 6px; } +</style> + +<div class="example-wrapper"> + <h1>Hello {{ controller_name }}! ✅</h1> + + This friendly message is coming from: + <ul> + <li>Your controller at <code><a href="{{ '/var/www/symfony_docker/src/Controller/AdherentController.php'|file_link(0) }}">src/Controller/AdherentController.php</a></code></li> + <li>Your template at <code><a href="{{ '/var/www/symfony_docker/templates/adherent/index.html.twig'|file_link(0) }}">templates/adherent/index.html.twig</a></code></li> + </ul> +</div> +{% endblock %} -- GitLab