src/Entity/Product.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassProductRepository::class)]
  8. class Product
  9. {
  10.     use IdentifiableTrait;
  11.     #[ORM\Column(length255)]
  12.     private ?string $name null;
  13.     #[ORM\Column(length255)]
  14.     private ?string $reference null;
  15.     #[ORM\Column]
  16.     private ?bool $active null;
  17.     #[ORM\OneToMany(mappedBy'product'targetEntityInvoiceLine::class)]
  18.     private Collection $invoiceLines;
  19.     #[ORM\Column(nullabletrue)]
  20.     private ?bool $showInStats null;
  21.     #[ORM\OneToMany(mappedBy'product'targetEntityDotation::class)]
  22.     private Collection $dotations;
  23.     #[ORM\Column(nullabletrue)]
  24.     private ?bool $isDotation null;
  25.     #[ORM\ManyToOne(inversedBy'products')]
  26.     private ?ProductCategory $category null;
  27.     #[ORM\Column(nullabletrue)]
  28.     private ?bool $isInStockDotation null;
  29.     public function __construct()
  30.     {
  31.         $this->invoiceLines = new ArrayCollection();
  32.         $this->dotations    = new ArrayCollection();
  33.     }
  34.     public function __toString(): string
  35.     {
  36.         return $this->name;
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getName(): ?string
  43.     {
  44.         return $this->name;
  45.     }
  46.     public function setName(string $name): self
  47.     {
  48.         $this->name $name;
  49.         return $this;
  50.     }
  51.     public function getReference(): ?string
  52.     {
  53.         return $this->reference;
  54.     }
  55.     public function setReference(string $reference): self
  56.     {
  57.         $this->reference $reference;
  58.         return $this;
  59.     }
  60.     public function isActive(): ?bool
  61.     {
  62.         return $this->active;
  63.     }
  64.     public function setActive(bool $active): self
  65.     {
  66.         $this->active $active;
  67.         return $this;
  68.     }
  69.     /**
  70.      * @return Collection<int, InvoiceLine>
  71.      */
  72.     public function getInvoiceLines(): Collection
  73.     {
  74.         return $this->invoiceLines;
  75.     }
  76.     public function addInvoiceLine(InvoiceLine $invoiceLine): self
  77.     {
  78.         if (!$this->invoiceLines->contains($invoiceLine)) {
  79.             $this->invoiceLines->add($invoiceLine);
  80.             $invoiceLine->setProduct($this);
  81.         }
  82.         return $this;
  83.     }
  84.     public function removeInvoiceLine(InvoiceLine $invoiceLine): self
  85.     {
  86.         if ($this->invoiceLines->removeElement($invoiceLine)) {
  87.             // set the owning side to null (unless already changed)
  88.             if ($invoiceLine->getProduct() === $this) {
  89.                 $invoiceLine->setProduct(null);
  90.             }
  91.         }
  92.         return $this;
  93.     }
  94.     public function isShowInStats(): ?bool
  95.     {
  96.         return $this->showInStats;
  97.     }
  98.     public function setShowInStats(?bool $showInStats): self
  99.     {
  100.         $this->showInStats $showInStats;
  101.         return $this;
  102.     }
  103.     /**
  104.      * @return Collection<int, VisitReport>
  105.      */
  106.     public function getDotations(): Collection
  107.     {
  108.         return $this->dotations;
  109.     }
  110.     public function isIsDotation(): ?bool
  111.     {
  112.         return $this->isDotation;
  113.     }
  114.     public function setIsDotation(?bool $isDotation): static
  115.     {
  116.         $this->isDotation $isDotation;
  117.         return $this;
  118.     }
  119.     public function getCategory(): ?ProductCategory
  120.     {
  121.         return $this->category;
  122.     }
  123.     public function setCategory(?ProductCategory $category): static
  124.     {
  125.         $this->category $category;
  126.         return $this;
  127.     }
  128.     public function isIsInStockDotation(): ?bool
  129.     {
  130.         return $this->isInStockDotation;
  131.     }
  132.     public function setIsInStockDotation(?bool $isInStockDotation): static
  133.     {
  134.         $this->isInStockDotation $isInStockDotation;
  135.         return $this;
  136.     }
  137. }