src/Entity/InvoiceAffectation.php line 13

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