src/Entity/Status.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\StatusRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Entity(repositoryClass=StatusRepository::class)
  10.  */
  11. class Status
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=120)
  21.      */
  22.     private $label;
  23.     /**
  24.      * @ORM\Column(type="text", nullable=true)
  25.      */
  26.     private $description;
  27.     /**
  28.      * @Gedmo\Slug(fields={"label"})
  29.      * @ORM\Column(length=191)
  30.      */
  31.     private ?string $slug;
  32.     /**
  33.      * @ORM\OneToMany(targetEntity=Payment::class, mappedBy="status")
  34.      */
  35.     private $payments;
  36.     public function __construct()
  37.     {
  38.         $this->payments = new ArrayCollection();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getLabel(): ?string
  45.     {
  46.         return $this->label;
  47.     }
  48.     public function setLabel(string $label): self
  49.     {
  50.         $this->label $label;
  51.         return $this;
  52.     }
  53.     public function getDescription(): ?string
  54.     {
  55.         return $this->description;
  56.     }
  57.     public function setDescription(?string $description): self
  58.     {
  59.         $this->description $description;
  60.         return $this;
  61.     }
  62.     public function getSlug(): ?string
  63.     {
  64.         return $this->slug;
  65.     }
  66.     public function setSlug(string $slug): self
  67.     {
  68.         $this->slug $slug;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return Collection<int, Payment>
  73.      */
  74.     public function getPayments(): Collection
  75.     {
  76.         return $this->payments;
  77.     }
  78.     public function addPayment(Payment $payment): self
  79.     {
  80.         if (!$this->payments->contains($payment)) {
  81.             $this->payments[] = $payment;
  82.             $payment->setStatus($this);
  83.         }
  84.         return $this;
  85.     }
  86.     public function removePayment(Payment $payment): self
  87.     {
  88.         if ($this->payments->removeElement($payment)) {
  89.             // set the owning side to null (unless already changed)
  90.             if ($payment->getStatus() === $this) {
  91.                 $payment->setStatus(null);
  92.             }
  93.         }
  94.         return $this;
  95.     }
  96. }