Test ManyToMany Gauche schema

(Clients/Tables Reservations/Utilisateurs)
Test ManyToOne Gauche schema
(Reservations -> Tables)
This commit is contained in:
bethoulevj 2024-10-16 20:43:05 +02:00
parent eec612778c
commit ef60fa0ddf
20 changed files with 453 additions and 966 deletions

View File

@ -26,7 +26,7 @@ APP_SECRET=36d6a0fd0e8606a88d3cc51aed9e3dc5
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" # DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" # DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" # DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
DATABASE_URL="postgresql://bayardk:Btssio2024@172.20.96.1:5432/festinhegre?serverVersion=16&charset=utf8" DATABASE_URL="postgresql://postgres:root@localhost:5432/festinhegre?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ### ###< doctrine/doctrine-bundle ###
###> symfony/messenger ### ###> symfony/messenger ###

View File

@ -1,181 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241003154825 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE customer_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE discount_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE dishes_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE eat_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE have_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE "order_id_seq" INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE order_detail_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE ordering_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE reservation_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE reserve_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE status_order_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE status_table_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE "table_id_seq" INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE "user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE customer (id INT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, phone_number VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE customer_order (customer_id INT NOT NULL, order_id INT NOT NULL, PRIMARY KEY(customer_id, order_id))');
$this->addSql('CREATE INDEX IDX_3B1CE6A39395C3F3 ON customer_order (customer_id)');
$this->addSql('CREATE INDEX IDX_3B1CE6A38D9F6D38 ON customer_order (order_id)');
$this->addSql('CREATE TABLE customer_table (customer_id INT NOT NULL, table_id INT NOT NULL, PRIMARY KEY(customer_id, table_id))');
$this->addSql('CREATE INDEX IDX_381CFA7D9395C3F3 ON customer_table (customer_id)');
$this->addSql('CREATE INDEX IDX_381CFA7DECFF285C ON customer_table (table_id)');
$this->addSql('CREATE TABLE discount (id INT NOT NULL, dish_id INT DEFAULT NULL, description VARCHAR(255) NOT NULL, percentage VARCHAR(255) NOT NULL, fixed_amount DOUBLE PRECISION NOT NULL, start_date DATE NOT NULL, end_date DATE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_E1E0B40E148EB0CB ON discount (dish_id)');
$this->addSql('CREATE TABLE dishes (id INT NOT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, price DOUBLE PRECISION NOT NULL, status VARCHAR(255) NOT NULL, number_order VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE dishes_order (dishes_id INT NOT NULL, order_id INT NOT NULL, PRIMARY KEY(dishes_id, order_id))');
$this->addSql('CREATE INDEX IDX_A859E4CA05DD37A ON dishes_order (dishes_id)');
$this->addSql('CREATE INDEX IDX_A859E4C8D9F6D38 ON dishes_order (order_id)');
$this->addSql('CREATE TABLE eat (id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE have (id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE "order" (id INT NOT NULL, order_detail_id INT DEFAULT NULL, status_orders_id INT DEFAULT NULL, date_heure DATE NOT NULL, status_order VARCHAR(255) NOT NULL, price_order VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_F529939864577843 ON "order" (order_detail_id)');
$this->addSql('CREATE INDEX IDX_F5299398476B1A97 ON "order" (status_orders_id)');
$this->addSql('CREATE TABLE order_dishes (order_id INT NOT NULL, dishes_id INT NOT NULL, PRIMARY KEY(order_id, dishes_id))');
$this->addSql('CREATE INDEX IDX_9BC2C3888D9F6D38 ON order_dishes (order_id)');
$this->addSql('CREATE INDEX IDX_9BC2C388A05DD37A ON order_dishes (dishes_id)');
$this->addSql('CREATE TABLE order_customer (order_id INT NOT NULL, customer_id INT NOT NULL, PRIMARY KEY(order_id, customer_id))');
$this->addSql('CREATE INDEX IDX_60C16CB88D9F6D38 ON order_customer (order_id)');
$this->addSql('CREATE INDEX IDX_60C16CB89395C3F3 ON order_customer (customer_id)');
$this->addSql('CREATE TABLE order_detail (id INT NOT NULL, quantity INT NOT NULL, unitary_price VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE ordering (id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE reservation (id INT NOT NULL, date_heure DATE NOT NULL, number_customer INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE reserve (id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE status_order (id INT NOT NULL, status_order VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE status_table (id INT NOT NULL, status VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE "table" (id INT NOT NULL, status_table_id INT DEFAULT NULL, reservation_id INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_F6298F4671258F84 ON "table" (status_table_id)');
$this->addSql('CREATE INDEX IDX_F6298F46B83297E7 ON "table" (reservation_id)');
$this->addSql('CREATE TABLE table_customer (table_id INT NOT NULL, customer_id INT NOT NULL, PRIMARY KEY(table_id, customer_id))');
$this->addSql('CREATE INDEX IDX_1184A0D9ECFF285C ON table_customer (table_id)');
$this->addSql('CREATE INDEX IDX_1184A0D99395C3F3 ON table_customer (customer_id)');
$this->addSql('CREATE TABLE table_user (table_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(table_id, user_id))');
$this->addSql('CREATE INDEX IDX_C7459682ECFF285C ON table_user (table_id)');
$this->addSql('CREATE INDEX IDX_C7459682A76ED395 ON table_user (user_id)');
$this->addSql('CREATE TABLE "user" (id INT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, mail VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, role VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE user_reservation (user_id INT NOT NULL, reservation_id INT NOT NULL, PRIMARY KEY(user_id, reservation_id))');
$this->addSql('CREATE INDEX IDX_EBD380C0A76ED395 ON user_reservation (user_id)');
$this->addSql('CREATE INDEX IDX_EBD380C0B83297E7 ON user_reservation (reservation_id)');
$this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
$this->addSql('COMMENT ON COLUMN messenger_messages.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN messenger_messages.available_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN messenger_messages.delivered_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$
BEGIN
PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;');
$this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;');
$this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();');
$this->addSql('ALTER TABLE customer_order ADD CONSTRAINT FK_3B1CE6A39395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE customer_order ADD CONSTRAINT FK_3B1CE6A38D9F6D38 FOREIGN KEY (order_id) REFERENCES "order" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE customer_table ADD CONSTRAINT FK_381CFA7D9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE customer_table ADD CONSTRAINT FK_381CFA7DECFF285C FOREIGN KEY (table_id) REFERENCES "table" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE discount ADD CONSTRAINT FK_E1E0B40E148EB0CB FOREIGN KEY (dish_id) REFERENCES dishes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE dishes_order ADD CONSTRAINT FK_A859E4CA05DD37A FOREIGN KEY (dishes_id) REFERENCES dishes (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE dishes_order ADD CONSTRAINT FK_A859E4C8D9F6D38 FOREIGN KEY (order_id) REFERENCES "order" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE "order" ADD CONSTRAINT FK_F529939864577843 FOREIGN KEY (order_detail_id) REFERENCES order_detail (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE "order" ADD CONSTRAINT FK_F5299398476B1A97 FOREIGN KEY (status_orders_id) REFERENCES status_order (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE order_dishes ADD CONSTRAINT FK_9BC2C3888D9F6D38 FOREIGN KEY (order_id) REFERENCES "order" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE order_dishes ADD CONSTRAINT FK_9BC2C388A05DD37A FOREIGN KEY (dishes_id) REFERENCES dishes (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE order_customer ADD CONSTRAINT FK_60C16CB88D9F6D38 FOREIGN KEY (order_id) REFERENCES "order" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE order_customer ADD CONSTRAINT FK_60C16CB89395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE "table" ADD CONSTRAINT FK_F6298F4671258F84 FOREIGN KEY (status_table_id) REFERENCES status_table (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE "table" ADD CONSTRAINT FK_F6298F46B83297E7 FOREIGN KEY (reservation_id) REFERENCES reservation (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE table_customer ADD CONSTRAINT FK_1184A0D9ECFF285C FOREIGN KEY (table_id) REFERENCES "table" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE table_customer ADD CONSTRAINT FK_1184A0D99395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE table_user ADD CONSTRAINT FK_C7459682ECFF285C FOREIGN KEY (table_id) REFERENCES "table" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE table_user ADD CONSTRAINT FK_C7459682A76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE user_reservation ADD CONSTRAINT FK_EBD380C0A76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE user_reservation ADD CONSTRAINT FK_EBD380C0B83297E7 FOREIGN KEY (reservation_id) REFERENCES reservation (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE customer_id_seq CASCADE');
$this->addSql('DROP SEQUENCE discount_id_seq CASCADE');
$this->addSql('DROP SEQUENCE dishes_id_seq CASCADE');
$this->addSql('DROP SEQUENCE eat_id_seq CASCADE');
$this->addSql('DROP SEQUENCE have_id_seq CASCADE');
$this->addSql('DROP SEQUENCE "order_id_seq" CASCADE');
$this->addSql('DROP SEQUENCE order_detail_id_seq CASCADE');
$this->addSql('DROP SEQUENCE ordering_id_seq CASCADE');
$this->addSql('DROP SEQUENCE reservation_id_seq CASCADE');
$this->addSql('DROP SEQUENCE reserve_id_seq CASCADE');
$this->addSql('DROP SEQUENCE status_order_id_seq CASCADE');
$this->addSql('DROP SEQUENCE status_table_id_seq CASCADE');
$this->addSql('DROP SEQUENCE "table_id_seq" CASCADE');
$this->addSql('DROP SEQUENCE "user_id_seq" CASCADE');
$this->addSql('ALTER TABLE customer_order DROP CONSTRAINT FK_3B1CE6A39395C3F3');
$this->addSql('ALTER TABLE customer_order DROP CONSTRAINT FK_3B1CE6A38D9F6D38');
$this->addSql('ALTER TABLE customer_table DROP CONSTRAINT FK_381CFA7D9395C3F3');
$this->addSql('ALTER TABLE customer_table DROP CONSTRAINT FK_381CFA7DECFF285C');
$this->addSql('ALTER TABLE discount DROP CONSTRAINT FK_E1E0B40E148EB0CB');
$this->addSql('ALTER TABLE dishes_order DROP CONSTRAINT FK_A859E4CA05DD37A');
$this->addSql('ALTER TABLE dishes_order DROP CONSTRAINT FK_A859E4C8D9F6D38');
$this->addSql('ALTER TABLE "order" DROP CONSTRAINT FK_F529939864577843');
$this->addSql('ALTER TABLE "order" DROP CONSTRAINT FK_F5299398476B1A97');
$this->addSql('ALTER TABLE order_dishes DROP CONSTRAINT FK_9BC2C3888D9F6D38');
$this->addSql('ALTER TABLE order_dishes DROP CONSTRAINT FK_9BC2C388A05DD37A');
$this->addSql('ALTER TABLE order_customer DROP CONSTRAINT FK_60C16CB88D9F6D38');
$this->addSql('ALTER TABLE order_customer DROP CONSTRAINT FK_60C16CB89395C3F3');
$this->addSql('ALTER TABLE "table" DROP CONSTRAINT FK_F6298F4671258F84');
$this->addSql('ALTER TABLE "table" DROP CONSTRAINT FK_F6298F46B83297E7');
$this->addSql('ALTER TABLE table_customer DROP CONSTRAINT FK_1184A0D9ECFF285C');
$this->addSql('ALTER TABLE table_customer DROP CONSTRAINT FK_1184A0D99395C3F3');
$this->addSql('ALTER TABLE table_user DROP CONSTRAINT FK_C7459682ECFF285C');
$this->addSql('ALTER TABLE table_user DROP CONSTRAINT FK_C7459682A76ED395');
$this->addSql('ALTER TABLE user_reservation DROP CONSTRAINT FK_EBD380C0A76ED395');
$this->addSql('ALTER TABLE user_reservation DROP CONSTRAINT FK_EBD380C0B83297E7');
$this->addSql('DROP TABLE customer');
$this->addSql('DROP TABLE customer_order');
$this->addSql('DROP TABLE customer_table');
$this->addSql('DROP TABLE discount');
$this->addSql('DROP TABLE dishes');
$this->addSql('DROP TABLE dishes_order');
$this->addSql('DROP TABLE eat');
$this->addSql('DROP TABLE have');
$this->addSql('DROP TABLE "order"');
$this->addSql('DROP TABLE order_dishes');
$this->addSql('DROP TABLE order_customer');
$this->addSql('DROP TABLE order_detail');
$this->addSql('DROP TABLE ordering');
$this->addSql('DROP TABLE reservation');
$this->addSql('DROP TABLE reserve');
$this->addSql('DROP TABLE status_order');
$this->addSql('DROP TABLE status_table');
$this->addSql('DROP TABLE "table"');
$this->addSql('DROP TABLE table_customer');
$this->addSql('DROP TABLE table_user');
$this->addSql('DROP TABLE "user"');
$this->addSql('DROP TABLE user_reservation');
$this->addSql('DROP TABLE messenger_messages');
}
}

117
src/Entity/Clients.php Normal file
View File

@ -0,0 +1,117 @@
<?php
namespace App\Entity;
use App\Repository\ClientsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ClientsRepository::class)]
class Clients
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Prenom = null;
#[ORM\Column(length: 255)]
private ?string $Nom = null;
#[ORM\Column(length: 255)]
private ?string $Email = null;
#[ORM\Column(length: 255)]
private ?string $Telephone = null;
/**
* @var Collection<int, Tables>
*/
#[ORM\ManyToMany(targetEntity: Tables::class, inversedBy: 'Tabl')]
private Collection $Tabl;
public function __construct()
{
$this->Tabl = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getPrenom(): ?string
{
return $this->Prenom;
}
public function setPrenom(string $Prenom): static
{
$this->Prenom = $Prenom;
return $this;
}
public function getNom(): ?string
{
return $this->Nom;
}
public function setNom(string $Nom): static
{
$this->Nom = $Nom;
return $this;
}
public function getEmail(): ?string
{
return $this->Email;
}
public function setEmail(string $Email): static
{
$this->Email = $Email;
return $this;
}
public function getTelephone(): ?string
{
return $this->Telephone;
}
public function setTelephone(string $Telephone): static
{
$this->Telephone = $Telephone;
return $this;
}
/**
* @return Collection<int, Tables>
*/
public function getTabl(): Collection
{
return $this->Tabl;
}
public function addTabl(Tables $tabl): static
{
if (!$this->Tabl->contains($tabl)) {
$this->Tabl->add($tabl);
}
return $this;
}
public function removeTabl(Tables $tabl): static
{
$this->Tabl->removeElement($tabl);
return $this;
}
}

View File

@ -1,86 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\CustomerRepository;
use Doctrine\ORM\Mapping as ORM;
//table clients
#[ORM\Entity(repositoryClass: CustomerRepository::class)]
class Customer
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $FirstName = null;
#[ORM\Column(length: 255)]
private ?string $LastName = null;
#[ORM\Column(length: 255)]
private ?string $Email = null;
#[ORM\Column(length: 255)]
private ?string $PhoneNumber = null;
#[ORM\ManyToMany(targetEntity: Order::class, inversedBy: "Customer")]
private ?Order $order = null;
#[ORM\ManyToMany(targetEntity: Table::class, inversedBy: "Customer")]
private ?Table $Table = null;
public function getId(): ?int
{
return $this->id;
}
public function getFirstName(): ?string
{
return $this->FirstName;
}
public function setFirstName(string $FirstName): static
{
$this->FirstName = $FirstName;
return $this;
}
public function getLastName(): ?string
{
return $this->LastName;
}
public function setLastName(string $LastName): static
{
$this->LastName = $LastName;
return $this;
}
public function getEmail(): ?string
{
return $this->Email;
}
public function setEmail(string $Email): static
{
$this->Email = $Email;
return $this;
}
public function getPhoneNumber(): ?string
{
return $this->PhoneNumber;
}
public function setPhoneNumber(string $PhoneNumber): static
{
$this->PhoneNumber = $PhoneNumber;
return $this;
}
}

View File

@ -1,100 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\DiscountRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
//table réductions
#[ORM\Entity(repositoryClass: DiscountRepository::class)]
class Discount
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Description = null;
#[ORM\Column(length: 255)]
private ?string $Percentage = null;
#[ORM\Column]
private ?float $FixedAmount = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $StartDate = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $EndDate = null;
#[ORM\ManyToOne(targetEntity: Dishes::class, inversedBy: "Discount")]
private ?Dishes $dish = null;
public function getId(): ?int
{
return $this->id;
}
public function getDescription(): ?string
{
return $this->Description;
}
public function setDescription(string $Description): static
{
$this->Description = $Description;
return $this;
}
public function getPercentage(): ?string
{
return $this->Percentage;
}
public function setPercentage(string $Percentage): static
{
$this->Percentage = $Percentage;
return $this;
}
public function getFixedAmount(): ?float
{
return $this->FixedAmount;
}
public function setFixedAmount(float $FixedAmount): static
{
$this->FixedAmount = $FixedAmount;
return $this;
}
public function getStartDate(): ?\DateTimeInterface
{
return $this->StartDate;
}
public function setStartDate(\DateTimeInterface $StartDate): static
{
$this->StartDate = $StartDate;
return $this;
}
public function getEndDate(): ?\DateTimeInterface
{
return $this->EndDate;
}
public function setEndDate(\DateTimeInterface $EndDate): static
{
$this->EndDate = $EndDate;
return $this;
}
}

View File

@ -1,103 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\DishesRepository;
use Doctrine\ORM\Mapping as ORM;
use phpDocumentor\Reflection\Types\Collection;
//table plats
#[ORM\Entity(repositoryClass: DishesRepository::class)]
class Dishes
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Name = null;
#[ORM\Column(length: 255)]
private ?string $Description = null;
#[ORM\Column]
private ?float $Price = null;
#[ORM\Column(length: 255)]
private ?string $Status = null;
#[ORM\Column(length: 255)]
private ?string $NumberOrder = null;
#[ORM\OneToMany(targetEntity: Discount::class, mappedBy: "Dishes")]
private Collection $dish ;
#[ORM\ManyToMany(targetEntity: Order::class, inversedBy: "Dishes")]
private ?Order $order = null;
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 getDescription(): ?string
{
return $this->Description;
}
public function setDescription(string $Description): static
{
$this->Description = $Description;
return $this;
}
public function getPrice(): ?float
{
return $this->Price;
}
public function setPrice(float $Price): static
{
$this->Price = $Price;
return $this;
}
public function getStatus(): ?string
{
return $this->Status;
}
public function setStatus(string $Status): static
{
$this->Status = $Status;
return $this;
}
public function getNumberOrder(): ?string
{
return $this->NumberOrder;
}
public function setNumberOrder(string $NumberOrder): static
{
$this->NumberOrder = $NumberOrder;
return $this;
}
}

View File

@ -1,20 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\EatRepository;
use Doctrine\ORM\Mapping as ORM;
//table manger
#[ORM\Entity(repositoryClass: EatRepository::class)]
class Eat
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
public function getId(): ?int
{
return $this->id;
}
}

View File

@ -1,20 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\HaveRepository;
use Doctrine\ORM\Mapping as ORM;
//table avoir
#[ORM\Entity(repositoryClass: HaveRepository::class)]
class Have
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
public function getId(): ?int
{
return $this->id;
}
}

View File

@ -1,81 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\OrderRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use phpDocumentor\Reflection\Types\Collection;
//table commande
#[ORM\Entity(repositoryClass: OrderRepository::class)]
#[ORM\Table(name: '`order`')]
class Order
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $DateHeure = null;
#[ORM\Column(length: 255)]
private ?string $StatusOrder = null;
#[ORM\Column(length: 255)]
private ?string $PriceOrder = null;
#[ORM\ManyToMany(targetEntity: Dishes::class, inversedBy: "Order")]
private ?Dishes $dish = null;
#[ORM\ManyToOne(targetEntity: OrderDetail::class, inversedBy: "Order")]
private ?OrderDetail $OrderDetail = null;
#[ORM\ManyToOne(targetEntity: StatusOrder::class, inversedBy: "Order")]
private Collection $StatusOrders;
#[ORM\ManyToMany(targetEntity: Customer::class, inversedBy: "Order")]
private ?Customer $Customer = null;
public function getId(): ?int
{
return $this->id;
}
public function getDateHeure(): ?\DateTimeInterface
{
return $this->DateHeure;
}
public function setDateHeure(\DateTimeInterface $DateHeure): static
{
$this->DateHeure = $DateHeure;
return $this;
}
public function getStatusOrder(): ?string
{
return $this->StatusOrder;
}
public function setStatusOrder(string $StatusOrder): static
{
$this->StatusOrder = $StatusOrder;
return $this;
}
public function getPriceOrder(): ?string
{
return $this->PriceOrder;
}
public function setPriceOrder(string $PriceOrder): static
{
$this->PriceOrder = $PriceOrder;
return $this;
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\OrderDetailRepository;
use Doctrine\ORM\Mapping as ORM;
use phpDocumentor\Reflection\Types\Collection;
// table détails des commandes
#[ORM\Entity(repositoryClass: OrderDetailRepository::class)]
class OrderDetail
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column]
private ?int $Quantity = null;
#[ORM\Column(length: 255)]
private ?string $UnitaryPrice = null;
#[ORM\OneToMany(targetEntity: Order::class, mappedBy: "OrderDetail")]
private Collection $order ;
public function getId(): ?int
{
return $this->id;
}
public function getQuantity(): ?int
{
return $this->Quantity;
}
public function setQuantity(int $Quantity): static
{
$this->Quantity = $Quantity;
return $this;
}
public function getUnitaryPrice(): ?string
{
return $this->UnitaryPrice;
}
public function setUnitaryPrice(string $UnitaryPrice): static
{
$this->UnitaryPrice = $UnitaryPrice;
return $this;
}
}

View File

@ -1,20 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\OrderingRepository;
use Doctrine\ORM\Mapping as ORM;
// TABLE COMMANDER
#[ORM\Entity(repositoryClass: OrderingRepository::class)]
class Ordering
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
public function getId(): ?int
{
return $this->id;
}
}

View File

@ -1,56 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\BookingRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use phpDocumentor\Reflection\Types\Collection;
//TABLE RESERVERation
#[ORM\Entity(repositoryClass: BookingRepository::class)]
class Reservation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $DateHeure = null;
#[ORM\Column]
private ?int $NumberCustomer = null;
#[ORM\OneToMany(targetEntity: Table::class, mappedBy: "Reservation")]
private Collection $Table;
public function getId(): ?int
{
return $this->id;
}
public function getDateHeure(): ?\DateTimeInterface
{
return $this->DateHeure;
}
public function setDateHeure(\DateTimeInterface $DateHeure): static
{
$this->DateHeure = $DateHeure;
return $this;
}
public function getNumberCustomer(): ?int
{
return $this->NumberCustomer;
}
public function setNumberCustomer(int $NumberCustomer): static
{
$this->NumberCustomer = $NumberCustomer;
return $this;
}
}

106
src/Entity/Reservations.php Normal file
View File

@ -0,0 +1,106 @@
<?php
namespace App\Entity;
use App\Repository\ReservationsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ReservationsRepository::class)]
class Reservations
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $DateHeure = null;
#[ORM\Column]
private ?int $Nb_de_prsn = null;
#[ORM\ManyToOne(inversedBy: 'reservations')]
private ?Tables $Tabl = null;
/**
* @var Collection<int, Utilisateurs>
*/
#[ORM\ManyToMany(targetEntity: Utilisateurs::class, mappedBy: 'Reservation')]
private Collection $utilisateurs;
public function __construct()
{
$this->utilisateurs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDateHeure(): ?\DateTimeInterface
{
return $this->DateHeure;
}
public function setDateHeure(\DateTimeInterface $DateHeure): static
{
$this->DateHeure = $DateHeure;
return $this;
}
public function getNbDePrsn(): ?int
{
return $this->Nb_de_prsn;
}
public function setNbDePrsn(int $Nb_de_prsn): static
{
$this->Nb_de_prsn = $Nb_de_prsn;
return $this;
}
public function getTabl(): ?Tables
{
return $this->Tabl;
}
public function setTabl(?Tables $Tabl): static
{
$this->Tabl = $Tabl;
return $this;
}
/**
* @return Collection<int, Utilisateurs>
*/
public function getUtilisateurs(): Collection
{
return $this->utilisateurs;
}
public function addUtilisateur(Utilisateurs $utilisateur): static
{
if (!$this->utilisateurs->contains($utilisateur)) {
$this->utilisateurs->add($utilisateur);
$utilisateur->addReservation($this);
}
return $this;
}
public function removeUtilisateur(Utilisateurs $utilisateur): static
{
if ($this->utilisateurs->removeElement($utilisateur)) {
$utilisateur->removeReservation($this);
}
return $this;
}
}

View File

@ -1,20 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\ReserveRepository;
use Doctrine\ORM\Mapping as ORM;
// TABLE RESERVER
#[ORM\Entity(repositoryClass: ReserveRepository::class)]
class Reserve
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
public function getId(): ?int
{
return $this->id;
}
}

View File

@ -1,40 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\StatusOrderRepository;
use Doctrine\ORM\Mapping as ORM;
use phpDocumentor\Reflection\Types\Collection;
// table status commande
#[ORM\Entity(repositoryClass: StatusOrderRepository::class)]
class StatusOrder
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $StatusOrder = null;
#[ORM\OneToMany(targetEntity: Order::class, mappedBy: "StatusOrder")]
private Collection $Order;
public function getId(): ?int
{
return $this->id;
}
public function getStatusOrder(): ?string
{
return $this->StatusOrder;
}
public function setStatusOrder(string $StatusOrder): static
{
$this->StatusOrder = $StatusOrder;
return $this;
}
}

View File

@ -1,40 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\StatusTableRepository;
use Doctrine\ORM\Mapping as ORM;
use phpDocumentor\Reflection\Types\Collection;
// table status tables
#[ORM\Entity(repositoryClass: StatusTableRepository::class)]
class StatusTable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Status = null;
#[ORM\OneToMany(targetEntity: Table::class, mappedBy: "StatusTable")]
private Collection $Tables;
public function getId(): ?int
{
return $this->id;
}
public function getStatus(): ?string
{
return $this->Status;
}
public function setStatus(string $Status): static
{
$this->Status = $Status;
return $this;
}
}

View File

@ -1,40 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\TableRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpClient\Exception\ClientException;
// table table
#[ORM\Entity(repositoryClass: TableRepository::class)]
#[ORM\Table(name: '`table`')]
class Table
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToMany(targetEntity: Customer::class, inversedBy: "Table")]
private ?Customer $customer = null;
#[ORM\ManyToOne(targetEntity: StatusTable::class, inversedBy: "Table")]
private ?StatusTable $statusTable = null;
#[ORM\ManyToOne(targetEntity: Reservation::class, inversedBy: "Table")]
private ?Reservation $reservation = null;
#[ORM\ManyToMany(targetEntity: User::class, inversedBy: "Table")]
private ?User $User = null;
public function getId(): ?int
{
return $this->id;
}
}

97
src/Entity/Tables.php Normal file
View File

@ -0,0 +1,97 @@
<?php
namespace App\Entity;
use App\Repository\TablesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: TablesRepository::class)]
class Tables
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
/**
* @var Collection<int, Clients>
*/
#[ORM\ManyToMany(targetEntity: Clients::class, mappedBy: 'Tabl')]
private Collection $Tabl;
/**
* @var Collection<int, Reservations>
*/
#[ORM\OneToMany(targetEntity: Reservations::class, mappedBy: 'Tabl')]
private Collection $reservations;
public function __construct()
{
$this->Tabl = new ArrayCollection();
$this->reservations = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection<int, Clients>
*/
public function getTabl(): Collection
{
return $this->Tabl;
}
public function addTabl(Clients $tabl): static
{
if (!$this->Tabl->contains($tabl)) {
$this->Tabl->add($tabl);
$tabl->addTabl($this);
}
return $this;
}
public function removeTabl(Clients $tabl): static
{
if ($this->Tabl->removeElement($tabl)) {
$tabl->removeTabl($this);
}
return $this;
}
/**
* @return Collection<int, Reservations>
*/
public function getReservations(): Collection
{
return $this->reservations;
}
public function addReservation(Reservations $reservation): static
{
if (!$this->reservations->contains($reservation)) {
$this->reservations->add($reservation);
$reservation->setTabl($this);
}
return $this;
}
public function removeReservation(Reservations $reservation): static
{
if ($this->reservations->removeElement($reservation)) {
// set the owning side to null (unless already changed)
if ($reservation->getTabl() === $this) {
$reservation->setTabl(null);
}
}
return $this;
}
}

View File

@ -1,103 +0,0 @@
<?php
namespace App\Entity;
// table Utilisateur
use App\Repository\UserRepository;
use Doctrine\ORM\Mapping as ORM;
use phpDocumentor\Reflection\Types\Collection;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\Table(name: '`user`')]
class User
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $FirstName = null;
#[ORM\Column(length: 255)]
private ?string $LastName = null;
#[ORM\Column(length: 255)]
private ?string $Mail = null;
#[ORM\Column(length: 255)]
private ?string $Password = null;
#[ORM\Column(length: 255)]
private ?string $Role = null;
#[ORM\ManyToMany(targetEntity: Reservation::class, inversedBy: "User")]
private ?Reservation $Reservation = null;
#[ORM\OneToMany(targetEntity: Table::class, mappedBy: "User")]
private Table $Table ;
public function getId(): ?int
{
return $this->id;
}
public function getFirstName(): ?string
{
return $this->FirstName;
}
public function setFirstName(string $FirstName): static
{
$this->FirstName = $FirstName;
return $this;
}
public function getLastName(): ?string
{
return $this->LastName;
}
public function setLastName(string $LastName): static
{
$this->LastName = $LastName;
return $this;
}
public function getMail(): ?string
{
return $this->Mail;
}
public function setMail(string $Mail): static
{
$this->Mail = $Mail;
return $this;
}
public function getPassword(): ?string
{
return $this->Password;
}
public function setPassword(string $Password): static
{
$this->Password = $Password;
return $this;
}
public function getRole(): ?string
{
return $this->Role;
}
public function setRole(string $Role): static
{
$this->Role = $Role;
return $this;
}
}

132
src/Entity/Utilisateurs.php Normal file
View File

@ -0,0 +1,132 @@
<?php
namespace App\Entity;
use App\Repository\UtilisateursRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: UtilisateursRepository::class)]
class Utilisateurs
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Nom = null;
#[ORM\Column(length: 255)]
private ?string $Prenom = null;
#[ORM\Column(length: 255)]
private ?string $Mail = null;
#[ORM\Column(length: 255)]
private ?string $MotDePasse = null;
#[ORM\Column(length: 255)]
private ?string $Role = null;
/**
* @var Collection<int, Reservations>
*/
#[ORM\ManyToMany(targetEntity: Reservations::class, inversedBy: 'utilisateurs')]
private Collection $Reservation;
public function __construct()
{
$this->Reservation = 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;
}
public function getPrenom(): ?string
{
return $this->Prenom;
}
public function setPrenom(string $Prenom): static
{
$this->Prenom = $Prenom;
return $this;
}
public function getMail(): ?string
{
return $this->Mail;
}
public function setMail(string $Mail): static
{
$this->Mail = $Mail;
return $this;
}
public function getMotDePasse(): ?string
{
return $this->MotDePasse;
}
public function setMotDePasse(string $MotDePasse): static
{
$this->MotDePasse = $MotDePasse;
return $this;
}
public function getRole(): ?string
{
return $this->Role;
}
public function setRole(string $Role): static
{
$this->Role = $Role;
return $this;
}
/**
* @return Collection<int, Reservations>
*/
public function getReservation(): Collection
{
return $this->Reservation;
}
public function addReservation(Reservations $reservation): static
{
if (!$this->Reservation->contains($reservation)) {
$this->Reservation->add($reservation);
}
return $this;
}
public function removeReservation(Reservations $reservation): static
{
$this->Reservation->removeElement($reservation);
return $this;
}
}