src/Entity/Warehouse.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\WarehouseRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassWarehouseRepository::class)]
  8. class Warehouse
  9. {
  10.     use IdentifiableTrait;
  11.     #[ORM\Column(length255)]
  12.     private ?string $name null;
  13.     #[ORM\Column(length255)]
  14.     private ?string $slug null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $code null;
  17.     #[ORM\Column]
  18.     private ?bool $active null;
  19.     #[ORM\OneToMany(mappedBy'warehouse'targetEntityInvoice::class)]
  20.     private Collection $invoices;
  21.     public function __construct()
  22.     {
  23.         $this->invoices = new ArrayCollection();
  24.     }
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getName(): ?string
  30.     {
  31.         return $this->name;
  32.     }
  33.     public function setName(string $name): self
  34.     {
  35.         $this->name $name;
  36.         return $this;
  37.     }
  38.     public function getSlug(): ?string
  39.     {
  40.         return $this->slug;
  41.     }
  42.     public function setSlug(string $slug): self
  43.     {
  44.         $this->slug $slug;
  45.         return $this;
  46.     }
  47.     public function getCode(): ?string
  48.     {
  49.         return $this->code;
  50.     }
  51.     public function setCode(string $code): self
  52.     {
  53.         $this->code $code;
  54.         return $this;
  55.     }
  56.     public function isActive(): ?bool
  57.     {
  58.         return $this->active;
  59.     }
  60.     public function setActive(bool $active): self
  61.     {
  62.         $this->active $active;
  63.         return $this;
  64.     }
  65.     /**
  66.      * @return Collection<int, Invoice>
  67.      */
  68.     public function getInvoices(): Collection
  69.     {
  70.         return $this->invoices;
  71.     }
  72.     public function addInvoice(Invoice $invoice): self
  73.     {
  74.         if (!$this->invoices->contains($invoice)) {
  75.             $this->invoices->add($invoice);
  76.             $invoice->setWarehouse($this);
  77.         }
  78.         return $this;
  79.     }
  80.     public function removeInvoice(Invoice $invoice): self
  81.     {
  82.         if ($this->invoices->removeElement($invoice)) {
  83.             // set the owning side to null (unless already changed)
  84.             if ($invoice->getWarehouse() === $this) {
  85.                 $invoice->setWarehouse(null);
  86.             }
  87.         }
  88.         return $this;
  89.     }
  90. }