src/Entity/CommandeStatus.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CommandeStatusRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassCommandeStatusRepository::class)]
  8. class CommandeStatus
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $statusDesc null;
  16.     #[ORM\OneToMany(mappedBy'cmdStatus'targetEntityCommande::class)]
  17.     private Collection $commandes;
  18.     public function __construct()
  19.     {
  20.         $this->commandes = new ArrayCollection();
  21.         
  22.         
  23.     }
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getStatusDesc(): ?string
  29.     {
  30.         return $this->statusDesc;
  31.     }
  32.     public function setStatusDesc(string $statusDesc): self
  33.     {
  34.         $this->statusDesc $statusDesc;
  35.         return $this;
  36.     }
  37.     public function __toString(): string{
  38.         return $this->statusDesc;
  39.     }
  40.     /**
  41.      * @return Collection<int, Commande>
  42.      */
  43.     public function getCommandes(): Collection
  44.     {
  45.         return $this->commandes;
  46.     }
  47.     public function addCommande(Commande $commande): self
  48.     {
  49.         if (!$this->commandes->contains($commande)) {
  50.             $this->commandes->add($commande);
  51.             $commande->setCmdStatus($this);
  52.         }
  53.         return $this;
  54.     }
  55.     public function removeCommande(Commande $commande): self
  56.     {
  57.         if ($this->commandes->removeElement($commande)) {
  58.             // set the owning side to null (unless already changed)
  59.             if ($commande->getCmdStatus() === $this) {
  60.                 $commande->setCmdStatus(null);
  61.             }
  62.         }
  63.         return $this;
  64.     }
  65. }