src/Entity/MeasurementUnits.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MeasurementUnitsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. #[ORM\Entity(repositoryClassMeasurementUnitsRepository::class)]
  9. #[ORM\HasLifecycleCallbacks]
  10. class MeasurementUnits extends BaseEntity
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     #[Groups(['measurement:read'])]
  16.     private $id;
  17.     #[ORM\Column(type'string'length255)]
  18.     #[Groups(['measurement:read'])]
  19.     private $name;
  20.     #[ORM\Column(type'string'length255)]
  21.     #[Groups(['measurement:read'])]
  22.     private $symbol;
  23.     #[ORM\Column(type'string'length255nullabletrue)]
  24.     #[Groups(['measurement:read'])]
  25.     private $description;
  26.     #[ORM\Column(type'boolean'options: ['default' => false])]
  27.     #[Groups(['measurement:read'])]
  28.     private $isDiscrete;
  29.     #[ORM\OneToMany(mappedBy'selectedUnit'targetEntityProductsSold::class)]
  30.     private Collection $productsSolds;
  31.     #[ORM\OneToMany(mappedBy'selectedUnit'targetEntityInvoiceItem::class)]
  32.     private Collection $invoiceItems;
  33.     public function __construct()
  34.     {
  35.         $this->productsSolds = new ArrayCollection();
  36.         $this->invoiceItems = new ArrayCollection();
  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 getSymbol(): ?string
  52.     {
  53.         return $this->symbol;
  54.     }
  55.     public function setSymbol(string $symbol): self
  56.     {
  57.         $this->symbol $symbol;
  58.         return $this;
  59.     }
  60.     public function getDescription(): ?string
  61.     {
  62.         return $this->description;
  63.     }
  64.     public function setDescription(?string $description): self
  65.     {
  66.         $this->description $description;
  67.         return $this;
  68.     }
  69.     /**
  70.      * @return mixed
  71.      */
  72.     public function getIsDiscrete()
  73.     {
  74.         return $this->isDiscrete;
  75.     }
  76.     /**
  77.      * @param mixed $isDiscrete
  78.      */
  79.     public function setIsDiscrete($isDiscrete): void
  80.     {
  81.         $this->isDiscrete $isDiscrete;
  82.     }
  83.     /**
  84.      * @return Collection<int, ProductsSold>
  85.      */
  86.     public function getProductsSolds(): Collection
  87.     {
  88.         return $this->productsSolds;
  89.     }
  90.     public function addProductsSold(ProductsSold $productsSold): static
  91.     {
  92.         if (!$this->productsSolds->contains($productsSold)) {
  93.             $this->productsSolds->add($productsSold);
  94.             $productsSold->setSelectedUnit($this);
  95.         }
  96.         return $this;
  97.     }
  98.     public function removeProductsSold(ProductsSold $productsSold): static
  99.     {
  100.         if ($this->productsSolds->removeElement($productsSold)) {
  101.             // set the owning side to null (unless already changed)
  102.             if ($productsSold->getSelectedUnit() === $this) {
  103.                 $productsSold->setSelectedUnit(null);
  104.             }
  105.         }
  106.         return $this;
  107.     }
  108.     /**
  109.      * @return Collection<int, InvoiceItem>
  110.      */
  111.     public function getInvoiceItems(): Collection
  112.     {
  113.         return $this->invoiceItems;
  114.     }
  115.     public function addInvoiceItem(InvoiceItem $invoiceItem): static
  116.     {
  117.         if (!$this->invoiceItems->contains($invoiceItem)) {
  118.             $this->invoiceItems->add($invoiceItem);
  119.             $invoiceItem->setSelectedUnit($this);
  120.         }
  121.         return $this;
  122.     }
  123.     public function removeInvoiceItem(InvoiceItem $invoiceItem): static
  124.     {
  125.         if ($this->invoiceItems->removeElement($invoiceItem)) {
  126.             // set the owning side to null (unless already changed)
  127.             if ($invoiceItem->getSelectedUnit() === $this) {
  128.                 $invoiceItem->setSelectedUnit(null);
  129.             }
  130.         }
  131.         return $this;
  132.     }
  133. }