diff --git a/migrations/Version20231121091411.php b/migrations/Version20231121091411.php new file mode 100644 index 0000000..e52be4e --- /dev/null +++ b/migrations/Version20231121091411.php @@ -0,0 +1,33 @@ +addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(100) NOT NULL, fullname VARCHAR(100) NOT NULL, grade VARCHAR(50) DEFAULT NULL, mail VARCHAR(255) NOT NULL, mdp VARCHAR(255) NOT NULL, address VARCHAR(255) DEFAULT NULL, id_resto INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL, available_at DATETIME NOT NULL, delivered_at DATETIME DEFAULT NULL, INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE user'); + $this->addSql('DROP TABLE messenger_messages'); + } +} diff --git a/migrations/Version20231121092109.php b/migrations/Version20231121092109.php new file mode 100644 index 0000000..83fa21e --- /dev/null +++ b/migrations/Version20231121092109.php @@ -0,0 +1,33 @@ +addSql('CREATE TABLE resto (id INT AUTO_INCREMENT NOT NULL, pay VARCHAR(255) NOT NULL, ville VARCHAR(255) NOT NULL, address VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('ALTER TABLE user CHANGE grade grade VARCHAR(50) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE resto'); + $this->addSql('ALTER TABLE user CHANGE grade grade VARCHAR(50) DEFAULT \'Client\''); + } +} diff --git a/migrations/Version20231121092325.php b/migrations/Version20231121092325.php new file mode 100644 index 0000000..b4cd3e0 --- /dev/null +++ b/migrations/Version20231121092325.php @@ -0,0 +1,31 @@ +addSql('CREATE TABLE menu (id INT AUTO_INCREMENT NOT NULL, entre VARCHAR(255) DEFAULT NULL, plat VARCHAR(255) DEFAULT NULL, dessert VARCHAR(255) DEFAULT NULL, id_resto INT NOT NULL, id_users INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE menu'); + } +} diff --git a/migrations/Version20231121092649.php b/migrations/Version20231121092649.php new file mode 100644 index 0000000..c60f0c0 --- /dev/null +++ b/migrations/Version20231121092649.php @@ -0,0 +1,31 @@ +addSql('CREATE TABLE ticket (id INT AUTO_INCREMENT NOT NULL, id_resto INT NOT NULL, id_users INT NOT NULL, payement VARCHAR(50) NOT NULL, id_menu INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE ticket'); + } +} diff --git a/migrations/Version20231121093127.php b/migrations/Version20231121093127.php new file mode 100644 index 0000000..5f4592c --- /dev/null +++ b/migrations/Version20231121093127.php @@ -0,0 +1,31 @@ +addSql('CREATE TABLE avis (id INT AUTO_INCREMENT NOT NULL, note INT DEFAULT NULL, com VARCHAR(255) NOT NULL, id_ticket INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE avis'); + } +} diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php new file mode 100644 index 0000000..07aad4f --- /dev/null +++ b/src/Controller/HomeController.php @@ -0,0 +1,18 @@ +render('home/index.html.twig', [ + 'controller_name' => 'HomeController', + ]); + } +} diff --git a/src/Entity/Avis.php b/src/Entity/Avis.php new file mode 100644 index 0000000..0913dbf --- /dev/null +++ b/src/Entity/Avis.php @@ -0,0 +1,65 @@ +id; + } + + public function getNote(): ?int + { + return $this->note; + } + + public function setNote(?int $note): static + { + $this->note = $note; + + return $this; + } + + public function getCom(): ?string + { + return $this->com; + } + + public function setCom(string $com): static + { + $this->com = $com; + + return $this; + } + + public function getIdTicket(): ?int + { + return $this->id_ticket; + } + + public function setIdTicket(int $id_ticket): static + { + $this->id_ticket = $id_ticket; + + return $this; + } +} diff --git a/src/Entity/Menu.php b/src/Entity/Menu.php new file mode 100644 index 0000000..d964823 --- /dev/null +++ b/src/Entity/Menu.php @@ -0,0 +1,95 @@ +id; + } + + public function getEntre(): ?string + { + return $this->entre; + } + + public function setEntre(?string $entre): static + { + $this->entre = $entre; + + return $this; + } + + public function getPlat(): ?string + { + return $this->plat; + } + + public function setPlat(?string $plat): static + { + $this->plat = $plat; + + return $this; + } + + public function getDessert(): ?string + { + return $this->dessert; + } + + public function setDessert(?string $dessert): static + { + $this->dessert = $dessert; + + return $this; + } + + public function getIdResto(): ?int + { + return $this->id_resto; + } + + public function setIdResto(int $id_resto): static + { + $this->id_resto = $id_resto; + + return $this; + } + + public function getIdUsers(): ?int + { + return $this->id_users; + } + + public function setIdUsers(int $id_users): static + { + $this->id_users = $id_users; + + return $this; + } +} diff --git a/src/Entity/Resto.php b/src/Entity/Resto.php new file mode 100644 index 0000000..c02aa25 --- /dev/null +++ b/src/Entity/Resto.php @@ -0,0 +1,65 @@ +id; + } + + public function getPay(): ?string + { + return $this->pay; + } + + public function setPay(string $pay): static + { + $this->pay = $pay; + + return $this; + } + + public function getVille(): ?string + { + return $this->ville; + } + + public function setVille(string $ville): static + { + $this->ville = $ville; + + return $this; + } + + public function getAddress(): ?string + { + return $this->address; + } + + public function setAddress(string $address): static + { + $this->address = $address; + + return $this; + } +} diff --git a/src/Entity/Ticket.php b/src/Entity/Ticket.php new file mode 100644 index 0000000..f37846b --- /dev/null +++ b/src/Entity/Ticket.php @@ -0,0 +1,80 @@ +id; + } + + public function getIdResto(): ?int + { + return $this->id_resto; + } + + public function setIdResto(int $id_resto): static + { + $this->id_resto = $id_resto; + + return $this; + } + + public function getIdUsers(): ?int + { + return $this->id_users; + } + + public function setIdUsers(int $id_users): static + { + $this->id_users = $id_users; + + return $this; + } + + public function getPayement(): ?string + { + return $this->payement; + } + + public function setPayement(string $payement): static + { + $this->payement = $payement; + + return $this; + } + + public function getIdMenu(): ?int + { + return $this->id_menu; + } + + public function setIdMenu(int $id_menu): static + { + $this->id_menu = $id_menu; + + return $this; + } +} diff --git a/src/Entity/User.php b/src/Entity/User.php new file mode 100644 index 0000000..e625497 --- /dev/null +++ b/src/Entity/User.php @@ -0,0 +1,125 @@ +id; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } + + public function getFullname(): ?string + { + return $this->fullname; + } + + public function setFullname(string $fullname): static + { + $this->fullname = $fullname; + + return $this; + } + + public function getGrade(): ?string + { + return $this->grade; + } + + public function setGrade(?string $grade): static + { + $this->grade = $grade; + + return $this; + } + + public function getMail(): ?string + { + return $this->mail; + } + + public function setMail(string $mail): static + { + $this->mail = $mail; + + return $this; + } + + public function getMdp(): ?string + { + return $this->mdp; + } + + public function setMdp(string $mdp): static + { + $this->mdp = $mdp; + + return $this; + } + + public function getAddress(): ?string + { + return $this->address; + } + + public function setAddress(?string $address): static + { + $this->address = $address; + + return $this; + } + + public function getIdResto(): ?int + { + return $this->id_resto; + } + + public function setIdResto(?int $id_resto): static + { + $this->id_resto = $id_resto; + + return $this; + } +} diff --git a/src/Repository/AvisRepository.php b/src/Repository/AvisRepository.php new file mode 100644 index 0000000..d298ed2 --- /dev/null +++ b/src/Repository/AvisRepository.php @@ -0,0 +1,48 @@ + + * + * @method Avis|null find($id, $lockMode = null, $lockVersion = null) + * @method Avis|null findOneBy(array $criteria, array $orderBy = null) + * @method Avis[] findAll() + * @method Avis[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class AvisRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Avis::class); + } + +// /** +// * @return Avis[] Returns an array of Avis 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): ?Avis +// { +// return $this->createQueryBuilder('a') +// ->andWhere('a.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/MenuRepository.php b/src/Repository/MenuRepository.php new file mode 100644 index 0000000..6cd8f3b --- /dev/null +++ b/src/Repository/MenuRepository.php @@ -0,0 +1,48 @@ + + * + * @method Menu|null find($id, $lockMode = null, $lockVersion = null) + * @method Menu|null findOneBy(array $criteria, array $orderBy = null) + * @method Menu[] findAll() + * @method Menu[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class MenuRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Menu::class); + } + +// /** +// * @return Menu[] Returns an array of Menu objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('m.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Menu +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/RestoRepository.php b/src/Repository/RestoRepository.php new file mode 100644 index 0000000..36de9c4 --- /dev/null +++ b/src/Repository/RestoRepository.php @@ -0,0 +1,48 @@ + + * + * @method Resto|null find($id, $lockMode = null, $lockVersion = null) + * @method Resto|null findOneBy(array $criteria, array $orderBy = null) + * @method Resto[] findAll() + * @method Resto[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class RestoRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Resto::class); + } + +// /** +// * @return Resto[] Returns an array of Resto 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): ?Resto +// { +// return $this->createQueryBuilder('r') +// ->andWhere('r.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/TicketRepository.php b/src/Repository/TicketRepository.php new file mode 100644 index 0000000..7c36c70 --- /dev/null +++ b/src/Repository/TicketRepository.php @@ -0,0 +1,48 @@ + + * + * @method Ticket|null find($id, $lockMode = null, $lockVersion = null) + * @method Ticket|null findOneBy(array $criteria, array $orderBy = null) + * @method Ticket[] findAll() + * @method Ticket[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class TicketRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Ticket::class); + } + +// /** +// * @return Ticket[] Returns an array of Ticket 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): ?Ticket +// { +// return $this->createQueryBuilder('t') +// ->andWhere('t.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php new file mode 100644 index 0000000..3767526 --- /dev/null +++ b/src/Repository/UserRepository.php @@ -0,0 +1,48 @@ + + * + * @method User|null find($id, $lockMode = null, $lockVersion = null) + * @method User|null findOneBy(array $criteria, array $orderBy = null) + * @method User[] findAll() + * @method User[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class UserRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, User::class); + } + +// /** +// * @return User[] Returns an array of User objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('u') +// ->andWhere('u.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('u.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?User +// { +// return $this->createQueryBuilder('u') +// ->andWhere('u.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig new file mode 100644 index 0000000..203bcce --- /dev/null +++ b/templates/home/index.html.twig @@ -0,0 +1,20 @@ +{% extends 'base.html.twig' %} + +{% block title %}Hello HomeController!{% endblock %} + +{% block body %} + + +
+

Hello {{ controller_name }}! ✅

+ + This friendly message is coming from: + +
+{% endblock %}