src/Entity/Products.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Doctrine\ORM\Mapping\InverseJoinColumn;
  8. use Doctrine\ORM\Mapping\JoinColumn;
  9. use Doctrine\ORM\Mapping\JoinTable;
  10. #[ORM\Table(name'products')]
  11. #[ORM\Index(name'name'columns: ['name'], flags: ['fulltext'])]
  12. #[ORM\Index(name'active_ingredient'columns: ['active_ingredient'], flags: ['fulltext'])]
  13. #[ORM\Index(name'description'columns: ['description'], flags: ['fulltext'])]
  14. #[ORM\Entity(repositoryClassProductsRepository::class)]
  15. class Products
  16. {
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column(type'integer')]
  20.     private $id;
  21.     #[ORM\ManyToOne(targetEntitySubCategories::class, inversedBy'products')]
  22.     private $subCategory;
  23.     #[ORM\Column(type'boolean')]
  24.     private $isPublished;
  25.     #[ORM\Column(type'string'length255)]
  26.     private $name;
  27.     #[ORM\Column(type'string'length255)]
  28.     private $activeIngredient;
  29.     #[ORM\Column(type'string'length255nullabletrue)]
  30.     private $image;
  31.     #[ORM\Column(type'text'nullabletrue)]
  32.     private $description;
  33.     #[ORM\Column(type'string'length255nullabletrue)]
  34.     private $dosage;
  35.     #[ORM\Column(type'string'length255nullabletrue)]
  36.     private $size;
  37.     #[ORM\Column(type'string'length255nullabletrue)]
  38.     private $form;
  39.     #[ORM\Column(type'string'length255)]
  40.     private $unit;
  41.     #[ORM\Column(type'float')]
  42.     private $unitPrice;
  43.     #[ORM\Column(type'integer')]
  44.     private $stockCount;
  45.     #[ORM\Column(type'datetime')]
  46.     private $modified;
  47.     #[ORM\Column(type'datetime')]
  48.     private $created;
  49.     #[ORM\OneToMany(targetEntityDistributorProducts::class, mappedBy'product')]
  50.     private $distributorProducts;
  51.     #[ORM\OneToMany(targetEntityOrderItems::class, mappedBy'product')]
  52.     private $orderItems;
  53.     #[ORM\OneToMany(targetEntityProductNotes::class, mappedBy'product')]
  54.     private $productNotes;
  55.     #[ORM\OneToMany(targetEntityProductReviews::class, mappedBy'product')]
  56.     private $productReviews;
  57.     #[ORM\OneToMany(targetEntityAvailabilityTracker::class, mappedBy'product')]
  58.     private $availabilityTrackers;
  59.     #[ORM\OneToMany(targetEntityListItems::class, mappedBy'product')]
  60.     private $listItems;
  61.     #[ORM\OneToMany(targetEntityBasketItems::class, mappedBy'product')]
  62.     private $basketItems;
  63.     #[ORM\OneToMany(targetEntityClinicProducts::class, mappedBy'product')]
  64.     private $clinicProducts;
  65.     #[ORM\OneToMany(targetEntityProductFavourites::class, mappedBy'product')]
  66.     private $productFavourites;
  67.     #[ORM\Column(type'string'length255nullabletrue)]
  68.     private $sku;
  69.     #[ORM\OneToMany(targetEntityProductManufacturers::class, mappedBy'products')]
  70.     private $productManufacturers;
  71.     #[ORM\OneToMany(targetEntityProductImages::class, mappedBy'product')]
  72.     private $productImages;
  73.     #[ORM\Column(type'boolean')]
  74.     private $expiryDateRequired;
  75.     #[ORM\OneToMany(targetEntityProductsSpecies::class, mappedBy'products')]
  76.     private $productsSpecies;
  77.     #[ORM\ManyToOne(targetEntityCategories2::class, inversedBy'products')]
  78.     private $category2;
  79.     #[ORM\ManyToOne(targetEntityCategories3::class, inversedBy'products')]
  80.     private $category3;
  81.     #[ORM\Column(type'json'nullabletrue)]
  82.     private $tags = [];
  83.     #[ORM\Column(type'text'nullabletrue)]
  84.     private $slug;
  85.     #[ORM\ManyToOne(targetEntityCategories1::class, inversedBy'products')]
  86.     private $category;
  87.     #[ORM\Column(type'boolean')]
  88.     private $isActive;
  89.     #[ORM\Column(type'float'nullabletrue)]
  90.     private $priceFrom;
  91.     #[ORM\Column(type'string'length255nullabletrue)]
  92.     private $dosageUnit;
  93.     #[ORM\Column(type'json'nullabletrue)]
  94.     private $manufacturerIds = [];
  95.     #[ORM\OneToMany(targetEntityProductRetail::class, mappedBy'product')]
  96.     private $productRetails;
  97.     #[ORM\Column(type'boolean'nullabletrue)]
  98.     private $isControlled;
  99.     public function __construct()
  100.     {
  101.         $this->setCreated(new \DateTime());
  102.         if ($this->getModified() == null) {
  103.             $this->setModified(new \DateTime());
  104.         }
  105.         $this->distributorProducts = new ArrayCollection();
  106.         $this->orderItems = new ArrayCollection();
  107.         $this->productNotes = new ArrayCollection();
  108.         $this->productReviews = new ArrayCollection();
  109.         $this->availabilityTrackers = new ArrayCollection();
  110.         $this->productsSpecies = new ArrayCollection();
  111.         $this->listItems = new ArrayCollection();
  112.         $this->basketItems = new ArrayCollection();
  113.         $this->clinicProducts = new ArrayCollection();
  114.         $this->productFavourites = new ArrayCollection();
  115.         $this->productManufacturers = new ArrayCollection();
  116.         $this->productImages = new ArrayCollection();
  117.         $this->productRetails = new ArrayCollection();
  118.     }
  119.     public function getId(): ?int
  120.     {
  121.         return $this->id;
  122.     }
  123.     public function getSubCategory(): ?SubCategories
  124.     {
  125.         return $this->subCategory;
  126.     }
  127.     public function setSubCategory(?SubCategories $subCategory): self
  128.     {
  129.         $this->subCategory $subCategory;
  130.         return $this;
  131.     }
  132.     public function getIsPublished(): ?bool
  133.     {
  134.         return $this->isPublished;
  135.     }
  136.     public function setIsPublished(bool $isPublished): self
  137.     {
  138.         $this->isPublished $isPublished;
  139.         return $this;
  140.     }
  141.     public function getIsActive(): ?bool
  142.     {
  143.         return $this->isActive;
  144.     }
  145.     public function setIsActive(bool $isActive): self
  146.     {
  147.         $this->isActive $isActive;
  148.         return $this;
  149.     }
  150.     public function getName(): ?string
  151.     {
  152.         return $this->name;
  153.     }
  154.     public function setName(string $name): self
  155.     {
  156.         $this->name $name;
  157.         return $this;
  158.     }
  159.     public function getActiveIngredient(): ?string
  160.     {
  161.         return $this->activeIngredient;
  162.     }
  163.     public function setActiveIngredient(string $activeIngredient): self
  164.     {
  165.         $this->activeIngredient $activeIngredient;
  166.         return $this;
  167.     }
  168.     public function getImage(): ?string
  169.     {
  170.         return $this->image;
  171.     }
  172.     public function setImage(?string $image): self
  173.     {
  174.         $this->image $image;
  175.         return $this;
  176.     }
  177.     public function getDescription(): ?string
  178.     {
  179.         return $this->description;
  180.     }
  181.     public function setDescription(?string $description): self
  182.     {
  183.         $this->description $description;
  184.         return $this;
  185.     }
  186.     public function getDosage(): ?string
  187.     {
  188.         return $this->dosage;
  189.     }
  190.     public function setDosage(?string $dosage): self
  191.     {
  192.         $this->dosage $dosage;
  193.         return $this;
  194.     }
  195.     public function getSize(): ?string
  196.     {
  197.         return $this->size;
  198.     }
  199.     public function setSize(?string $size): self
  200.     {
  201.         $this->size $size;
  202.         return $this;
  203.     }
  204.     public function getForm(): ?string
  205.     {
  206.         return $this->form;
  207.     }
  208.     public function setForm(string $form): self
  209.     {
  210.         $this->form $form;
  211.         return $this;
  212.     }
  213.     public function getUnit(): ?string
  214.     {
  215.         return $this->unit;
  216.     }
  217.     public function setUnit(string $unit): self
  218.     {
  219.         $this->unit $unit;
  220.         return $this;
  221.     }
  222.     public function getUnitPrice(): ?float
  223.     {
  224.         return $this->unitPrice;
  225.     }
  226.     public function setUnitPrice(float $unitPrice): self
  227.     {
  228.         $this->unitPrice $unitPrice;
  229.         return $this;
  230.     }
  231.     public function getStockCount(): ?int
  232.     {
  233.         return $this->stockCount;
  234.     }
  235.     public function setStockCount(int $stockCount): self
  236.     {
  237.         $this->stockCount $stockCount;
  238.         return $this;
  239.     }
  240.     public function getModified(): ?\DateTimeInterface
  241.     {
  242.         return $this->modified;
  243.     }
  244.     public function setModified(\DateTimeInterface $modified): self
  245.     {
  246.         $this->modified $modified;
  247.         return $this;
  248.     }
  249.     public function getCreated(): ?\DateTimeInterface
  250.     {
  251.         return $this->created;
  252.     }
  253.     public function setCreated(\DateTimeInterface $created): self
  254.     {
  255.         $this->created $created;
  256.         return $this;
  257.     }
  258.     /**
  259.      * @return Collection|DistributorProducts[]
  260.      */
  261.     public function getDistributorProducts(): Collection
  262.     {
  263.         return $this->distributorProducts;
  264.     }
  265.     public function addDistributorProduct(DistributorProducts $distributorProduct): self
  266.     {
  267.         if (!$this->distributorProducts->contains($distributorProduct)) {
  268.             $this->distributorProducts[] = $distributorProduct;
  269.             $distributorProduct->setProduct($this);
  270.         }
  271.         return $this;
  272.     }
  273.     public function removeDistributorProduct(DistributorProducts $distributorProduct): self
  274.     {
  275.         if ($this->distributorProducts->removeElement($distributorProduct)) {
  276.             // set the owning side to null (unless already changed)
  277.             if ($distributorProduct->getProduct() === $this) {
  278.                 $distributorProduct->setProduct(null);
  279.             }
  280.         }
  281.         return $this;
  282.     }
  283.     /**
  284.      * @return Collection|OrderItems[]
  285.      */
  286.     public function getOrderItems(): Collection
  287.     {
  288.         return $this->orderItems;
  289.     }
  290.     public function addOrderItem(OrderItems $orderItem): self
  291.     {
  292.         if (!$this->orderItems->contains($orderItem)) {
  293.             $this->orderItems[] = $orderItem;
  294.             $orderItem->setProduct($this);
  295.         }
  296.         return $this;
  297.     }
  298.     public function removeOrderItem(OrderItems $orderItem): self
  299.     {
  300.         if ($this->orderItems->removeElement($orderItem)) {
  301.             // set the owning side to null (unless already changed)
  302.             if ($orderItem->getProduct() === $this) {
  303.                 $orderItem->setProduct(null);
  304.             }
  305.         }
  306.         return $this;
  307.     }
  308.     /**
  309.      * @return Collection|ProductNotes[]
  310.      */
  311.     public function getProductNotes(): Collection
  312.     {
  313.         return $this->productNotes;
  314.     }
  315.     public function addProductNote(ProductNotes $productNote): self
  316.     {
  317.         if (!$this->productNotes->contains($productNote)) {
  318.             $this->productNotes[] = $productNote;
  319.             $productNote->setProduct($this);
  320.         }
  321.         return $this;
  322.     }
  323.     public function removeProductNote(ProductNotes $productNote): self
  324.     {
  325.         if ($this->productNotes->removeElement($productNote)) {
  326.             // set the owning side to null (unless already changed)
  327.             if ($productNote->getProduct() === $this) {
  328.                 $productNote->setProduct(null);
  329.             }
  330.         }
  331.         return $this;
  332.     }
  333.     /**
  334.      * @return Collection|ProductReviews[]
  335.      */
  336.     public function getProductReviews(): Collection
  337.     {
  338.         return $this->productReviews;
  339.     }
  340.     public function addProductReview(ProductReviews $productReview): self
  341.     {
  342.         if (!$this->productReviews->contains($productReview)) {
  343.             $this->productReviews[] = $productReview;
  344.             $productReview->setProduct($this);
  345.         }
  346.         return $this;
  347.     }
  348.     public function removeProductReview(ProductReviews $productReview): self
  349.     {
  350.         if ($this->productReviews->removeElement($productReview)) {
  351.             // set the owning side to null (unless already changed)
  352.             if ($productReview->getProduct() === $this) {
  353.                 $productReview->setProduct(null);
  354.             }
  355.         }
  356.         return $this;
  357.     }
  358.     /**
  359.      * @return Collection|AvailabilityTracker[]
  360.      */
  361.     public function getAvailabilityTrackers(): Collection
  362.     {
  363.         return $this->availabilityTrackers;
  364.     }
  365.     public function addAvailabilityTracker(AvailabilityTracker $availabilityTracker): self
  366.     {
  367.         if (!$this->availabilityTrackers->contains($availabilityTracker)) {
  368.             $this->availabilityTrackers[] = $availabilityTracker;
  369.             $availabilityTracker->setProduct($this);
  370.         }
  371.         return $this;
  372.     }
  373.     public function removeAvailabilityTracker(AvailabilityTracker $availabilityTracker): self
  374.     {
  375.         if ($this->availabilityTrackers->removeElement($availabilityTracker)) {
  376.             // set the owning side to null (unless already changed)
  377.             if ($availabilityTracker->getProduct() === $this) {
  378.                 $availabilityTracker->setProduct(null);
  379.             }
  380.         }
  381.         return $this;
  382.     }
  383.     /**
  384.      * @return Collection|Species[]
  385.      */
  386.     public function getProductsSpecies(): Collection
  387.     {
  388.         return $species $this->productsSpecies;
  389.     }
  390.     /**
  391.      * @return Collection<int, ListItems>
  392.      */
  393.     public function getListItems(): Collection
  394.     {
  395.         return $this->listItems;
  396.     }
  397.     public function addListItem(ListItems $listItem): self
  398.     {
  399.         if (!$this->listItems->contains($listItem)) {
  400.             $this->listItems[] = $listItem;
  401.             $listItem->setProduct($this);
  402.         }
  403.         return $this;
  404.     }
  405.     public function removeListItem(ListItems $listItem): self
  406.     {
  407.         if ($this->listItems->removeElement($listItem)) {
  408.             // set the owning side to null (unless already changed)
  409.             if ($listItem->getProduct() === $this) {
  410.                 $listItem->setProduct(null);
  411.             }
  412.         }
  413.         return $this;
  414.     }
  415.     /**
  416.      * @return Collection<int, BasketItems>
  417.      */
  418.     public function getBasketItems(): Collection
  419.     {
  420.         return $this->basketItems;
  421.     }
  422.     public function addBasketItem(BasketItems $basketItem): self
  423.     {
  424.         if (!$this->basketItems->contains($basketItem)) {
  425.             $this->basketItems[] = $basketItem;
  426.             $basketItem->setProduct($this);
  427.         }
  428.         return $this;
  429.     }
  430.     public function removeBasketItem(BasketItems $basketItem): self
  431.     {
  432.         if ($this->basketItems->removeElement($basketItem)) {
  433.             // set the owning side to null (unless already changed)
  434.             if ($basketItem->getProduct() === $this) {
  435.                 $basketItem->setProduct(null);
  436.             }
  437.         }
  438.         return $this;
  439.     }
  440.     /**
  441.      * @return Collection<int, ClinicProducts>
  442.      */
  443.     public function getClinicProducts(): Collection
  444.     {
  445.         return $this->clinicProducts;
  446.     }
  447.     public function addClinicProduct(ClinicProducts $clinicProduct): self
  448.     {
  449.         if (!$this->clinicProducts->contains($clinicProduct)) {
  450.             $this->clinicProducts[] = $clinicProduct;
  451.             $clinicProduct->setProduct($this);
  452.         }
  453.         return $this;
  454.     }
  455.     public function removeClinicProduct(ClinicProducts $clinicProduct): self
  456.     {
  457.         if ($this->clinicProducts->removeElement($clinicProduct)) {
  458.             // set the owning side to null (unless already changed)
  459.             if ($clinicProduct->getProduct() === $this) {
  460.                 $clinicProduct->setProduct(null);
  461.             }
  462.         }
  463.         return $this;
  464.     }
  465.     /**
  466.      * @return Collection<int, ProductFavourites>
  467.      */
  468.     public function getProductFavourites(): Collection
  469.     {
  470.         return $this->productFavourites;
  471.     }
  472.     public function addProductFavourite(ProductFavourites $productFavourite): self
  473.     {
  474.         if (!$this->productFavourites->contains($productFavourite)) {
  475.             $this->productFavourites[] = $productFavourite;
  476.             $productFavourite->setProduct($this);
  477.         }
  478.         return $this;
  479.     }
  480.     public function removeProductFavourite(ProductFavourites $productFavourite): self
  481.     {
  482.         if ($this->productFavourites->removeElement($productFavourite)) {
  483.             // set the owning side to null (unless already changed)
  484.             if ($productFavourite->getProduct() === $this) {
  485.                 $productFavourite->setProduct(null);
  486.             }
  487.         }
  488.         return $this;
  489.     }
  490.     public function getSku(): ?string
  491.     {
  492.         return $this->sku;
  493.     }
  494.     public function setSku(?string $sku): self
  495.     {
  496.         $this->sku $sku;
  497.         return $this;
  498.     }
  499.     /**
  500.      * @return Collection<int, ProductManufacturers>
  501.      */
  502.     public function getProductManufacturers(): Collection
  503.     {
  504.         return $this->productManufacturers;
  505.     }
  506.     /**
  507.      * @return Collection<int, ProductImages>
  508.      */
  509.     public function getProductImages(): Collection
  510.     {
  511.         return $this->productImages;
  512.     }
  513.     public function addProductImage(ProductImages $productImage): self
  514.     {
  515.         if (!$this->productImages->contains($productImage)) {
  516.             $this->productImages[] = $productImage;
  517.             $productImage->setProduct($this);
  518.         }
  519.         return $this;
  520.     }
  521.     public function removeProductImage(ProductImages $productImage): self
  522.     {
  523.         if ($this->productImages->removeElement($productImage)) {
  524.             // set the owning side to null (unless already changed)
  525.             if ($productImage->getProduct() === $this) {
  526.                 $productImage->setProduct(null);
  527.             }
  528.         }
  529.         return $this;
  530.     }
  531.     public function getExpiryDateRequired(): ?bool
  532.     {
  533.         return $this->expiryDateRequired;
  534.     }
  535.     public function setExpiryDateRequired(bool $expiryDateRequired): self
  536.     {
  537.         $this->expiryDateRequired $expiryDateRequired;
  538.         return $this;
  539.     }
  540.     public function getCategory2(): ?Categories2
  541.     {
  542.         return $this->category2;
  543.     }
  544.     public function setCategory2(?Categories2 $category2): self
  545.     {
  546.         $this->category2 $category2;
  547.         return $this;
  548.     }
  549.     public function getCategory3(): ?Categories3
  550.     {
  551.         return $this->category3;
  552.     }
  553.     public function setCategory3(?Categories3 $category3): self
  554.     {
  555.         $this->category3 $category3;
  556.         return $this;
  557.     }
  558.     public function getTags(): ?array
  559.     {
  560.         return $this->tags;
  561.     }
  562.     public function setTags(?array $tags): self
  563.     {
  564.         $this->tags $tags;
  565.         return $this;
  566.     }
  567.     public function getSlug(): ?string
  568.     {
  569.         return $this->slug;
  570.     }
  571.     public function setSlug(?string $slug): self
  572.     {
  573.         $this->slug $slug;
  574.         return $this;
  575.     }
  576.     public function getCategory(): ?Categories1
  577.     {
  578.         return $this->category;
  579.     }
  580.     public function setCategory(?Categories1 $category): self
  581.     {
  582.         $this->category $category;
  583.         return $this;
  584.     }
  585.     public function getPriceFrom(): ?float
  586.     {
  587.         return $this->priceFrom;
  588.     }
  589.     public function setPriceFrom(float $priceFrom): self
  590.     {
  591.         $this->priceFrom $priceFrom;
  592.         return $this;
  593.     }
  594.     public function getDosageUnit(): ?string
  595.     {
  596.         return $this->dosageUnit;
  597.     }
  598.     public function setDosageUnit(?string $dosageUnit): self
  599.     {
  600.         $this->dosageUnit $dosageUnit;
  601.         return $this;
  602.     }
  603.     public function getManufacturerIds(): ?array
  604.     {
  605.         return $this->manufacturerIds;
  606.     }
  607.     public function setManufacturerIds(?array $manufacturerIds): self
  608.     {
  609.         $this->manufacturerIds $manufacturerIds;
  610.         return $this;
  611.     }
  612.     /**
  613.      * @return Collection<int, ProductRetail>
  614.      */
  615.     public function getProductRetails(): Collection
  616.     {
  617.         return $this->productRetails;
  618.     }
  619.     public function addProductRetail(ProductRetail $productRetail): self
  620.     {
  621.         if (!$this->productRetails->contains($productRetail)) {
  622.             $this->productRetails[] = $productRetail;
  623.             $productRetail->setProduct($this);
  624.         }
  625.         return $this;
  626.     }
  627.     public function removeProductRetail(ProductRetail $productRetail): self
  628.     {
  629.         if ($this->productRetails->removeElement($productRetail)) {
  630.             // set the owning side to null (unless already changed)
  631.             if ($productRetail->getProduct() === $this) {
  632.                 $productRetail->setProduct(null);
  633.             }
  634.         }
  635.         return $this;
  636.     }
  637.     public function getIsControlled(): ?bool
  638.     {
  639.         return $this->isControlled;
  640.     }
  641.     public function setIsControlled(?bool $isControlled): self
  642.     {
  643.         $this->isControlled $isControlled;
  644.         return $this;
  645.     }
  646. }