src/Entity/Assignment.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AssignmentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassAssignmentRepository::class)]
  8. class Assignment
  9. {
  10.     use IdentifiableTrait;
  11.     #[ORM\Column(length255)]
  12.     private ?string $code null;
  13.     #[ORM\Column(length255)]
  14.     private ?string $slug null;
  15.     #[ORM\OneToMany(mappedBy'assignment'targetEntityInvoice::class)]
  16.     private Collection $invoices;
  17.     public function __construct()
  18.     {
  19.         $this->invoices = new ArrayCollection();
  20.     }
  21.     public function getId(): ?int
  22.     {
  23.         return $this->id;
  24.     }
  25.     public function getCode(): ?string
  26.     {
  27.         return $this->code;
  28.     }
  29.     public function setCode(string $code): self
  30.     {
  31.         $this->code $code;
  32.         return $this;
  33.     }
  34.     public function getSlug(): ?string
  35.     {
  36.         return $this->slug;
  37.     }
  38.     public function setSlug(string $slug): self
  39.     {
  40.         $this->slug $slug;
  41.         return $this;
  42.     }
  43.     /**
  44.      * @return Collection<int, Invoice>
  45.      */
  46.     public function getInvoices(): Collection
  47.     {
  48.         return $this->invoices;
  49.     }
  50.     public function addInvoice(Invoice $invoice): self
  51.     {
  52.         if (!$this->invoices->contains($invoice)) {
  53.             $this->invoices->add($invoice);
  54.             $invoice->setAssignment($this);
  55.         }
  56.         return $this;
  57.     }
  58.     public function removeInvoice(Invoice $invoice): self
  59.     {
  60.         if ($this->invoices->removeElement($invoice)) {
  61.             // set the owning side to null (unless already changed)
  62.             if ($invoice->getAssignment() === $this) {
  63.                 $invoice->setAssignment(null);
  64.             }
  65.         }
  66.         return $this;
  67.     }
  68. }