FestinHegre/src/Entity/Commandes.php

190 lines
4.2 KiB
PHP

<?php
namespace App\Entity;
use App\Repository\CommandesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CommandesRepository::class)]
class Commandes
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $DateHeure = null;
#[ORM\Column]
private ?bool $Statut = null;
#[ORM\Column]
private ?float $Total = null;
/**
* @var Collection<int, Clients>
*/
#[ORM\ManyToMany(targetEntity: Clients::class, inversedBy: 'commandes')]
private Collection $Client;
/**
* @var Collection<int, DetailsCommande>
*/
#[ORM\OneToMany(targetEntity: DetailsCommande::class, mappedBy: 'Commande')]
private Collection $detailsCommandes;
/**
* @var Collection<int, Plats>
*/
#[ORM\ManyToMany(targetEntity: Plats::class, mappedBy: 'Commande')]
private Collection $plats;
#[ORM\ManyToOne(inversedBy: 'commandes')]
private ?StatutCommandes $StatutCommande = null;
public function __construct()
{
$this->Client = new ArrayCollection();
$this->detailsCommandes = new ArrayCollection();
$this->plats = 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 isStatut(): ?bool
{
return $this->Statut;
}
public function setStatut(bool $Statut): static
{
$this->Statut = $Statut;
return $this;
}
public function getTotal(): ?float
{
return $this->Total;
}
public function setTotal(float $Total): static
{
$this->Total = $Total;
return $this;
}
/**
* @return Collection<int, Clients>
*/
public function getClient(): Collection
{
return $this->Client;
}
public function addClient(Clients $client): static
{
if (!$this->Client->contains($client)) {
$this->Client->add($client);
}
return $this;
}
public function removeClient(Clients $client): static
{
$this->Client->removeElement($client);
return $this;
}
/**
* @return Collection<int, DetailsCommande>
*/
public function getDetailsCommandes(): Collection
{
return $this->detailsCommandes;
}
public function addDetailsCommande(DetailsCommande $detailsCommande): static
{
if (!$this->detailsCommandes->contains($detailsCommande)) {
$this->detailsCommandes->add($detailsCommande);
$detailsCommande->setCommande($this);
}
return $this;
}
public function removeDetailsCommande(DetailsCommande $detailsCommande): static
{
if ($this->detailsCommandes->removeElement($detailsCommande)) {
// set the owning side to null (unless already changed)
if ($detailsCommande->getCommande() === $this) {
$detailsCommande->setCommande(null);
}
}
return $this;
}
/**
* @return Collection<int, Plats>
*/
public function getPlats(): Collection
{
return $this->plats;
}
public function addPlat(Plats $plat): static
{
if (!$this->plats->contains($plat)) {
$this->plats->add($plat);
$plat->addCommande($this);
}
return $this;
}
public function removePlat(Plats $plat): static
{
if ($this->plats->removeElement($plat)) {
$plat->removeCommande($this);
}
return $this;
}
public function getStatutCommande(): ?StatutCommandes
{
return $this->StatutCommande;
}
public function setStatutCommande(?StatutCommandes $StatutCommande): static
{
$this->StatutCommande = $StatutCommande;
return $this;
}
}