<?php
namespace App\Entity;
use App\Repository\CommandeStatusRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CommandeStatusRepository::class)]
class CommandeStatus
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $statusDesc = null;
#[ORM\OneToMany(mappedBy: 'cmdStatus', targetEntity: Commande::class)]
private Collection $commandes;
public function __construct()
{
$this->commandes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getStatusDesc(): ?string
{
return $this->statusDesc;
}
public function setStatusDesc(string $statusDesc): self
{
$this->statusDesc = $statusDesc;
return $this;
}
public function __toString(): string{
return $this->statusDesc;
}
/**
* @return Collection<int, Commande>
*/
public function getCommandes(): Collection
{
return $this->commandes;
}
public function addCommande(Commande $commande): self
{
if (!$this->commandes->contains($commande)) {
$this->commandes->add($commande);
$commande->setCmdStatus($this);
}
return $this;
}
public function removeCommande(Commande $commande): self
{
if ($this->commandes->removeElement($commande)) {
// set the owning side to null (unless already changed)
if ($commande->getCmdStatus() === $this) {
$commande->setCmdStatus(null);
}
}
return $this;
}
}