<?php
namespace App\Entity;
use App\Contract\ManagedOrderInterface;
use App\Repository\TrGrosseCommandeRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=TrGrosseCommandeRepository::class)
*/
class TrGrosseCommande implements ManagedOrderInterface
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=TrProduits::class, inversedBy="trGrosseCommandes")
* @ORM\JoinColumn(nullable=false)
*/
private $PRODUIT;
/**
* @ORM\Column(type="integer")
*/
private $NOMBRE;
/**
* @ORM\Column(type="date")
*/
private $DATELIVRAISON;
/**
* @ORM\Column(type="string", length=255)
*/
private $TELEPHONE;
/**
* @ORM\Column(name="statut_commande", type="string", length=30, options={"default"="en_attente"})
*/
private $statut_commande = 'en_attente';
/**
* @ORM\Column(name="motif_annulation", type="text", nullable=true)
*/
private $motif_annulation;
/**
* @ORM\Column(name="date_annulation", type="datetime", nullable=true)
*/
private $date_annulation;
/**
* @ORM\Column(name="date_livree_at", type="datetime", nullable=true)
*/
private $date_livree_at;
public function getId(): ?int
{
return $this->id;
}
public function getPRODUIT(): ?TrProduits
{
return $this->PRODUIT;
}
public function setPRODUIT(?TrProduits $PRODUIT): self
{
$this->PRODUIT = $PRODUIT;
return $this;
}
public function getNOMBRE(): ?int
{
return $this->NOMBRE;
}
public function setNOMBRE(int $NOMBRE): self
{
$this->NOMBRE = $NOMBRE;
return $this;
}
public function getDATELIVRAISON(): ?\DateTimeInterface
{
return $this->DATELIVRAISON;
}
public function setDATELIVRAISON(\DateTimeInterface $DATELIVRAISON): self
{
$this->DATELIVRAISON = $DATELIVRAISON;
return $this;
}
public function getTELEPHONE(): ?string
{
return $this->TELEPHONE;
}
public function setTELEPHONE(string $TELEPHONE): self
{
$this->TELEPHONE = $TELEPHONE;
return $this;
}
public function getReferenceCommande(): ?string
{
$year = $this->DATELIVRAISON instanceof \DateTimeInterface
? $this->DATELIVRAISON->format('Y')
: (new \DateTimeImmutable())->format('Y');
return sprintf('CG-%s-%05d', $year, (int) $this->id);
}
public function getTelephoneCommande(): ?string
{
return $this->getTELEPHONE();
}
public function getStatutCommande(): ?string
{
return $this->statut_commande;
}
public function setStatutCommande(?string $statut_commande): self
{
$this->statut_commande = $statut_commande;
return $this;
}
public function getPlannedDeliveryDate(): ?\DateTimeInterface
{
return $this->getDATELIVRAISON();
}
public function setPlannedDeliveryDate(?\DateTimeInterface $date_livraison): self
{
if (null !== $date_livraison) {
$this->setDATELIVRAISON($date_livraison);
}
return $this;
}
public function getMotifAnnulation(): ?string
{
return $this->motif_annulation;
}
public function setMotifAnnulation(?string $motif_annulation): self
{
$this->motif_annulation = $motif_annulation;
return $this;
}
public function getDateAnnulation(): ?\DateTimeInterface
{
return $this->date_annulation;
}
public function setDateAnnulation(?\DateTimeInterface $date_annulation): self
{
$this->date_annulation = $date_annulation;
return $this;
}
public function getDateLivreeAt(): ?\DateTimeInterface
{
return $this->date_livree_at;
}
public function setDateLivreeAt(?\DateTimeInterface $date_livree_at): self
{
$this->date_livree_at = $date_livree_at;
return $this;
}
}