<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\CommandeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CommandeRepository::class)]
#[ApiResource]
class Commande
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'commandes')]
private ?User $user = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $soustotal = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $tva = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $total = null;
#[ORM\Column(nullable: true)]
private ?bool $isPayer = null;
#[ORM\OneToMany(mappedBy: 'commande', targetEntity: CommandeFormation::class ,cascade: ['remove'])]
private Collection $commandeFormations;
#[ORM\Column(nullable: true)]
private ?bool $isVu = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $statut = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $facture = null;
#[ORM\OneToMany(mappedBy: 'commande', targetEntity: Facture::class,cascade: ['remove'])]
private Collection $factures;
#[ORM\Column(length: 255, nullable: true)]
private ?string $commande = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $numfact = null;
public function __construct()
{
$this->commandeFormations = new ArrayCollection();
$this->factures = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(?\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getSoustotal(): ?string
{
return $this->soustotal;
}
public function setSoustotal(?string $soustotal): self
{
$this->soustotal = $soustotal;
return $this;
}
public function getTva(): ?string
{
return $this->tva;
}
public function setTva(?string $tva): self
{
$this->tva = $tva;
return $this;
}
public function getTotal(): ?string
{
return $this->total;
}
public function setTotal(?string $total): self
{
$this->total = $total;
return $this;
}
public function isIsPayer(): ?bool
{
return $this->isPayer;
}
public function setIsPayer(?bool $isPayer): self
{
$this->isPayer = $isPayer;
return $this;
}
/**
* @return Collection<int, CommandeFormation>
*/
public function getCommandeFormations(): Collection
{
return $this->commandeFormations;
}
public function addCommandeFormation(CommandeFormation $commandeFormation): self
{
if (!$this->commandeFormations->contains($commandeFormation)) {
$this->commandeFormations->add($commandeFormation);
$commandeFormation->setCommande($this);
}
return $this;
}
public function removeCommandeFormation(CommandeFormation $commandeFormation): self
{
if ($this->commandeFormations->removeElement($commandeFormation)) {
// set the owning side to null (unless already changed)
if ($commandeFormation->getCommande() === $this) {
$commandeFormation->setCommande(null);
}
}
return $this;
}
public function isIsVu(): ?bool
{
return $this->isVu;
}
public function setIsVu(?bool $isVu): self
{
$this->isVu = $isVu;
return $this;
}
public function getStatut(): ?string
{
return $this->statut;
}
public function setStatut(?string $statut): self
{
$this->statut = $statut;
return $this;
}
public function getFacture(): ?string
{
return $this->facture;
}
public function setFacture(?string $facture): self
{
$this->facture = $facture;
return $this;
}
/**
* @return Collection<int, Facture>
*/
public function getFactures(): Collection
{
return $this->factures;
}
public function addFacture(Facture $facture): self
{
if (!$this->factures->contains($facture)) {
$this->factures->add($facture);
$facture->setCommande($this);
}
return $this;
}
public function removeFacture(Facture $facture): self
{
if ($this->factures->removeElement($facture)) {
// set the owning side to null (unless already changed)
if ($facture->getCommande() === $this) {
$facture->setCommande(null);
}
}
return $this;
}
public function getCommande(): ?string
{
return $this->commande;
}
public function setCommande(?string $commande): self
{
$this->commande = $commande;
return $this;
}
public function getNumfact(): ?string
{
return $this->numfact;
}
public function setNumfact(?string $numfact): self
{
$this->numfact = $numfact;
return $this;
}
}