src/Entity/Operation/Odr.php line 108

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Operation;
  3. use App\Entity\MediaObject\MediaCodeOdr;
  4. use App\Entity\PeriodicityOperationMultiOffer;
  5. use App\Manager\Operation\OperationManager;
  6. use ApiPlatform\Core\Annotation\ApiFilter;
  7. use ApiPlatform\Core\Annotation\ApiResource;
  8. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
  9. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
  10. use App\Controller\Api\Operation\Odr\GetAllPublicOdrs;
  11. use App\Controller\Api\Operation\Odr\GetOdrParticipationByUser;
  12. use App\Controller\Api\Operation\Odr\GetOneOdr;
  13. use App\Controller\Api\Operation\Odr\GetOneOperationOdr;
  14. use App\Entity\Details\Operation\DetailsOdr;
  15. use App\Entity\MediaObject\MediaDesktopOdr;
  16. use App\Entity\MediaObject\MediaMobileOdr;
  17. use App\Entity\MediaObject\MediaPdfOdr;
  18. use App\Entity\MediaObject\MediaThumbnailOdr;
  19. use App\Repository\Operation\OdrRepository;
  20. use App\Service\DateUtils;
  21. use Exception;
  22. use Doctrine\Common\Collections\ArrayCollection;
  23. use Doctrine\ORM\Mapping as ORM;
  24. use Symfony\Component\Serializer\Annotation\Groups;
  25. use Symfony\Component\Serializer\Annotation\SerializedName;
  26. use Symfony\Component\Validator\Constraints as Assert;
  27. /**
  28.  * @ORM\Entity(repositoryClass=OdrRepository::class)
  29.  * @ApiResource(
  30.  *     attributes={
  31.  *          "force_eager"=false,
  32.  *          "normalization_context"={
  33.  *              "groups"={
  34.  *                  "OperationOdr:output",
  35.  *                  "OperationOdr:io",
  36.  *                  "get_one_public_odr",
  37.  *                  "get_all_odr_user",
  38.  *              },
  39.  *              "enable_max_depth"=true
  40.  *          },
  41.  *          "denormalization_context"={
  42.  *              "groups"={
  43.  *                  "OperationOdr:input",
  44.  *                  "OperationOdr:io",
  45.  *                  "get_one_public_odr",
  46.  *              },
  47.  *              "enable_max_depth"=true
  48.  *          },
  49.  *         "order"={"startDate": "ASC"}
  50.  *      },
  51.  *     collectionOperations={
  52.  *          "post"={
  53.  *              "method"="POST",
  54.  *              "access_control"="is_granted('ROLE_ADMIN_SOGEC')",
  55.  *          },
  56.  *          "public-get"={
  57.  *              "path"="/public/odrs",
  58.  *              "method"="GET",
  59.  *              "controller"=GetAllPublicOdrs::class,
  60.  *              "access_control"="is_granted('ROLE_PUBLIC')",
  61.  *          },
  62.  *          "get-all-odr-user"={
  63.  *              "method"="GET",
  64.  *              "path"="/odrs",
  65.  *              "access_control"="is_granted('ROLE_USER')",
  66.  *              "validation_groups"={"get_all_odr_user"},
  67.  *              "controller"=GetOdrParticipationByUser::class,
  68.  *              "defaults"={"_api_receive"=false},
  69.  *          },
  70.  *     },
  71.  *     itemOperations={
  72.  *          "put"={
  73.  *              "method"="PUT",
  74.  *              "access_control"="is_granted('ROLE_ADMIN_SOGEC')",
  75.  *          },
  76.  *          "public-get"={
  77.  *              "method"="GET",
  78.  *              "path"="/public/offer-odr/{id}",
  79.  *              "access_control"="is_granted('ROLE_PUBLIC')",
  80.  *              "validation_groups"={"get_one_public_odr"},
  81.  *              "controller"=GetOneOdr::class,
  82.  *              "defaults"={"_api_receive"=false},
  83.  *          },
  84.  *           "public-get-operation-odr"={
  85.  *               "method"="GET",
  86.  *               "path"="/public/operation-odr/{id}",
  87.  *               "access_control"="is_granted('ROLE_PUBLIC')",
  88.  *               "validation_groups"={"get_one_public_odr"},
  89.  *               "controller"=GetOneOperationOdr::class,
  90.  *               "defaults"={"_api_receive"=false},
  91.  *           },
  92.  *          "get-public"={
  93.  *              "method"="GET",
  94.  *              "path"="/public/odr/{id}",
  95.  *              "controller"=GetOneOdr::class,
  96.  *          },
  97.  *          "get-odr-by-user"={
  98.  *              "method"="GET",
  99.  *              "controller"=GetOneOdr::class,
  100.  *              "path"="/odr/{id}",
  101.  *          },
  102.  *      }
  103.  * )
  104.  */
  105. class Odr extends Operation
  106. {
  107.     /**
  108.      * @ORM\Column(type="string", length=255, nullable=true)
  109.      * @SerializedName("subtitle")
  110.      * @Groups({
  111.      *     "OperationOdr:output",
  112.      *     "ParticipationOdr:io",
  113.      *     "OperationOdr:io",
  114.      *     "get_all_odr_user",
  115.      * })
  116.      */
  117.     private ?string $subtitle;
  118.     /**
  119.      * @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"})
  120.      * @Assert\GreaterThan(propertyPath="billyStartDate")
  121.      * @Assert\NotBlank()
  122.      * @Groups({
  123.      *     "OperationOdr:io",
  124.      *     "get_participation_odrs_by_user",
  125.      *     "get_all_odr_user",
  126.      * })
  127.      * @ApiFilter(DateFilter::class, strategy=DateFilter::EXCLUDE_NULL)
  128.      */
  129.     private $startDate;
  130.     /**
  131.      * @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"})
  132.      * @Assert\LessThanOrEqual(propertyPath="billyEndDate")
  133.      * @Assert\NotBlank()
  134.      * @Groups({
  135.      *     "OperationOdr:io",
  136.      *     "get_participation_odrs_by_user",
  137.      *     "get_all_odr_user",
  138.      * })
  139.      * @ApiFilter(DateFilter::class, strategy=DateFilter::EXCLUDE_NULL)
  140.      */
  141.     private $endDate;
  142.     /**
  143.      * @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"}, nullable=true)
  144.      * @Assert\NotBlank()
  145.      * @Groups({
  146.      *     "OperationOdr:io",
  147.      *     "get_all_odr_user",
  148.      * })
  149.      * @ApiFilter(DateFilter::class, strategy=DateFilter::EXCLUDE_NULL)
  150.      */
  151.     private ?\DateTimeInterface $billyStartDate;
  152.     /**
  153.      * @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"})
  154.      * @Assert\NotBlank()
  155.      * @Groups({
  156.      *     "OperationOdr:io",
  157.      *     "get_all_odr_user",
  158.      * })
  159.      * @ApiFilter(DateFilter::class, strategy=DateFilter::EXCLUDE_NULL)
  160.      */
  161.     private ?\DateTimeInterface $billyEndDate;
  162.     /**
  163.      * @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"})
  164.      * @Assert\NotBlank()
  165.      * @Groups({
  166.      *     "OperationOdr:io",
  167.      *     "get_all_odr_user",
  168.      * })
  169.      * @ApiFilter(DateFilter::class, strategy=DateFilter::EXCLUDE_NULL)
  170.      */
  171.     private ?\DateTimeInterface $subscriptionEndDate;
  172.     /**
  173.      * @var MediaThumbnailOdr
  174.      * @Assert\Valid()
  175.      * @Assert\NotBlank()
  176.      * @ORM\OneToMany(targetEntity=MediaThumbnailOdr::class, mappedBy="odr", cascade={"persist"})
  177.      * @SerializedName("thumbnail_odrs")
  178.      * @Groups({
  179.      *     "OperationOdr:output",
  180.      *     "MediaThumbnailOdr:io",
  181.      *     "get_all_odr_user",
  182.      * })
  183.      */
  184.     private $thumbnailOdrs;
  185.     /**
  186.      * @var MediaDesktopOdr
  187.      * @Assert\Valid()
  188.      * @Assert\NotBlank()
  189.      * @ORM\OneToMany(targetEntity=MediaDesktopOdr::class, mappedBy="odr", cascade={"persist"})
  190.      * @SerializedName("desktop_odrs")
  191.      * @Groups({
  192.      *     "OperationOdr:output",
  193.      *     "MediaDesktopOdr:io",
  194.      *     "get_all_odr_user",
  195.      * })
  196.      */
  197.     private $desktopOdrs;
  198.     /**
  199.      * @var MediaMobileOdr
  200.      * @Assert\Valid()
  201.      * @Assert\NotBlank()
  202.      * @ORM\OneToMany(targetEntity=MediaMobileOdr::class, mappedBy="odr", cascade={"persist"})
  203.      * @SerializedName("mobile_odrs")
  204.      * @Groups({
  205.      *     "OperationOdr:output",
  206.      *     "MediaMobileOdr:io",
  207.      *     "get_all_odr_user",
  208.      * })
  209.      */
  210.     private $mobileOdrs;
  211.     /**
  212.      * @var MediaPdfOdr
  213.      * @Assert\NotBlank()
  214.      * @Assert\Valid()
  215.      * @ORM\OneToMany(targetEntity=MediaPdfOdr::class, mappedBy="odr", cascade={"persist"})
  216.      * @SerializedName("pdf_odrs")
  217.      * @Groups({
  218.      *     "OperationOdr:output",
  219.      *     "MediaPdfOdr:io",
  220.      *     "get_all_odr_user",
  221.      * })
  222.      */
  223.     private $pdfOdrs;
  224.     /**
  225.      * @var MediaCodeOdr|null
  226.      * @ORM\OneToMany(targetEntity=MediaCodeOdr::class, mappedBy="odr", cascade={"persist"})
  227.      * @SerializedName("media_code_odrs")
  228.      * @Groups({
  229.      *     "MediaCodeOdr:io"
  230.      * })
  231.      */
  232.     private $mediaCodeOdrs;
  233.     /**
  234.      * @ORM\Column(type="boolean", options={"default": 0})
  235.      * @Groups({
  236.      *     "OperationOdr:io",
  237.      *     "get_all_odr_user",
  238.      * })
  239.      * @ApiFilter(BooleanFilter::class)
  240.      */
  241.     private bool $online false;
  242.     /**
  243.      * @ORM\Column(type="boolean", options={"default": 0})
  244.      * @Groups({
  245.      *     "OperationOdr:io",
  246.      *     "get_all_odr_user",
  247.      * })
  248.      * @ApiFilter(BooleanFilter::class)
  249.      */
  250.     private bool $receipt false;
  251.     /**
  252.      * @ORM\Column(type="boolean", options={"default": 0})
  253.      * @Groups({
  254.      *     "OperationOdr:io",
  255.      *     "get_all_odr_user",
  256.      * })
  257.      * @ApiFilter(BooleanFilter::class)
  258.      */
  259.     private bool $barCode false;
  260.     /**
  261.      * @SerializedName("max_part_by_user")
  262.      * @ORM\Column(type="integer")
  263.      * @Groups({
  264.      *     "OperationOdr:io",
  265.      * })
  266.      */
  267.     private $maxPartByUser;
  268.     /**
  269.      * @SerializedName("max_participation_per_month")
  270.      * @ORM\Column(type="integer")
  271.      * @Groups({
  272.      *     "OperationOdr:io",
  273.      * })
  274.      */
  275.     private $maxParticipationPerMonth;
  276.     /**
  277.      * @ORM\Column(type="string", length=255)
  278.      * @Groups({
  279.      *     "OperationOdr:io",
  280.      * })
  281.      */
  282.     private $periodicity;
  283.     /**
  284.      * @ORM\Column(type="text", columnDefinition="LONGTEXT", nullable=true)
  285.      * @SerializedName("first_step")
  286.      * @Groups({
  287.      *     "OperationOdr:output",
  288.      * })
  289.      */
  290.     private ?string $firstStep;
  291.     /**
  292.      * @ORM\Column(type="text", columnDefinition="LONGTEXT", nullable=true)
  293.      * @SerializedName("second_step")
  294.      * @Groups({
  295.      *     "OperationOdr:output",
  296.      * })
  297.      */
  298.     private ?string $secondStep;
  299.     /**
  300.      * @ORM\Column(type="text", columnDefinition="LONGTEXT", nullable=true)
  301.      * @SerializedName("third_step")
  302.      * @Groups({
  303.      *     "OperationOdr:output",
  304.      * })
  305.      */
  306.     private ?string $thirdStep;
  307.     /**
  308.      * @ORM\Column(type="text", columnDefinition="LONGTEXT", nullable=true)
  309.      * @SerializedName("fourth_step")
  310.      * @Groups({
  311.      *     "OperationOdr:output",
  312.      * })
  313.      */
  314.     private ?string $fourthStep;
  315.     /**
  316.      * @ORM\Column(type="text", columnDefinition="LONGTEXT", nullable=true)
  317.      * @SerializedName("fifth_step")
  318.      * @Groups({
  319.      *     "OperationOdr:output",
  320.      * })
  321.      */
  322.     private ?string $fifthStep;
  323.     /**
  324.      * @ORM\Column(type="integer", options={"default" : 0})
  325.      * @Groups({
  326.      *     "OperationOdr:io",
  327.      * })
  328.      */
  329.     private $stock 0;
  330.     /**
  331.      * @ORM\Column(type="integer", options={"default" : 0})
  332.      * @SerializedName("current_stock")
  333.      * @Groups({
  334.      *     "OperationOdr:io",
  335.      * })
  336.      */
  337.     private int $currentStock 0;
  338.     /**
  339.      * @ORM\Column(type="float", options={"default" : 0})
  340.      * @Groups({
  341.      *     "OperationOdr:io",
  342.      * })
  343.      */
  344.     private $percentage 0;
  345.     /**
  346.      * @ORM\OneToOne(targetEntity=DetailsOdr::class, mappedBy="operation", cascade={"persist", "remove"})
  347.      * @SerializedName("details_odr")
  348.      * @Groups({
  349.      *     "OperationOdr:io",
  350.      *     "get_all_public_odrs",
  351.      * })
  352.      */
  353.     private ?DetailsOdr $details;
  354.     /**
  355.      * @Groups({
  356.      *     "get_all_odr_user",
  357.      * })
  358.      */
  359.     private bool $participated false;
  360.     public function __construct()
  361.     {
  362.         parent::__construct();
  363.         $this->thumbnailOdrs = new ArrayCollection();
  364.         $this->desktopOdrs = new ArrayCollection();
  365.         $this->mobileOdrs = new ArrayCollection();
  366.         $this->pdfOdrs = new ArrayCollection();
  367.     }
  368.     public function getSubtitle(): ?string
  369.     {
  370.         return $this->subtitle;
  371.     }
  372.     public function setSubtitle(?string $subtitle): Odr
  373.     {
  374.         $this->subtitle $subtitle;
  375.         return $this;
  376.     }
  377.     public function getStartDate(): ?\DateTimeInterface
  378.     {
  379.         return $this->startDate;
  380.     }
  381.     public function setStartDate(\DateTimeInterface $startDate): self
  382.     {
  383.         $this->startDate $startDate;
  384.         return $this;
  385.     }
  386.     public function getEndDate(): ?\DateTimeInterface
  387.     {
  388.         return $this->endDate;
  389.     }
  390.     public function setEndDate(\DateTimeInterface $endDate): self
  391.     {
  392.         $this->endDate $endDate;
  393.         return $this;
  394.     }
  395.     public function getBillyStartDate(): ?\DateTimeInterface
  396.     {
  397.         return $this->billyStartDate;
  398.     }
  399.     public function setBillyStartDate(?\DateTimeInterface $billyStartDate): self
  400.     {
  401.         $this->billyStartDate $billyStartDate;
  402.         return $this;
  403.     }
  404.     public function getBillyEndDate(): ?\DateTimeInterface
  405.     {
  406.         return $this->billyEndDate;
  407.     }
  408.     public function setBillyEndDate(?\DateTimeInterface $billyEndDate): self
  409.     {
  410.         $this->billyEndDate $billyEndDate;
  411.         return $this;
  412.     }
  413.     public function getSubscriptionEndDate(): ?\DateTimeInterface
  414.     {
  415.         return $this->subscriptionEndDate;
  416.     }
  417.     public function setSubscriptionEndDate(?\DateTimeInterface $subscriptionEndDate): self
  418.     {
  419.         $this->subscriptionEndDate $subscriptionEndDate;
  420.         return $this;
  421.     }
  422.     public function isOnline(): bool
  423.     {
  424.         return (bool) $this->online;
  425.     }
  426.     public function getOnline(): bool
  427.     {
  428.         return (bool) $this->online;
  429.     }
  430.     public function setOnline(bool $online): self
  431.     {
  432.         $this->online $online;
  433.         return $this;
  434.     }
  435.     public function isReceipt(): bool
  436.     {
  437.         return (bool) $this->receipt;
  438.     }
  439.     public function getReceipt(): bool
  440.     {
  441.         return (bool) $this->receipt;
  442.     }
  443.     public function setReceipt(bool $receipt): self
  444.     {
  445.         $this->receipt $receipt;
  446.         return $this;
  447.     }
  448.     public function isBarCode(): bool
  449.     {
  450.         return (bool) $this->barCode;
  451.     }
  452.     public function getBarCode(): bool
  453.     {
  454.         return (bool) $this->barCode;
  455.     }
  456.     public function setBarCode(bool $barCode): self
  457.     {
  458.         $this->barCode $barCode;
  459.         return $this;
  460.     }
  461.     public function getMaxPartByUser(): ?int
  462.     {
  463.         return $this->maxPartByUser;
  464.     }
  465.     public function setMaxPartByUser(?int $maxPartByUser): self
  466.     {
  467.         $this->maxPartByUser $maxPartByUser;
  468.         return $this;
  469.     }
  470.     public function getThumbnailOdrs()
  471.     {
  472.         return $this->thumbnailOdrs;
  473.     }
  474.     public function setThumbnailOdr(MediaThumbnailOdr $thumbnailOdrs): Odr
  475.     {
  476.         $this->thumbnailOdrs $thumbnailOdrs;
  477.         return $this;
  478.     }
  479.     public function addThumbnailOdr(MediaThumbnailOdr $thumbnailOdr)
  480.     {
  481.         if ($this->thumbnailOdrs->contains($thumbnailOdr)) {
  482.             return;
  483.         }
  484.         $this->thumbnailOdrs[] = $thumbnailOdr;
  485.         $thumbnailOdr->setOdr($this);
  486.     }
  487.     public function getDesktopOdrs()
  488.     {
  489.         return $this->desktopOdrs;
  490.     }
  491.     public function setDesktopOdr(MediaDesktopOdr $desktopOdrs): Odr
  492.     {
  493.         $this->desktopOdrs $desktopOdrs;
  494.         return $this;
  495.     }
  496.     public function addDesktopOdr(MediaDesktopOdr $desktopOdr)
  497.     {
  498.         if ($this->desktopOdrs->contains($desktopOdr)) {
  499.             return;
  500.         }
  501.         $this->desktopOdrs[] = $desktopOdr;
  502.         $desktopOdr->setOdr($this);
  503.     }
  504.     public function getMobileOdrs()
  505.     {
  506.         return $this->mobileOdrs;
  507.     }
  508.     public function setMobileOdr(MediaMobileOdr $mobileOdrs): Odr
  509.     {
  510.         $this->mobileOdrs $mobileOdrs;
  511.         return $this;
  512.     }
  513.     public function addMobileOdr(MediaMobileOdr $mobileOdr)
  514.     {
  515.         if ($this->mobileOdrs->contains($mobileOdr)) {
  516.             return;
  517.         }
  518.         $this->mobileOdrs[] = $mobileOdr;
  519.         $mobileOdr->setOdr($this);
  520.     }
  521.     public function getPdfOdrs()
  522.     {
  523.         return $this->pdfOdrs;
  524.     }
  525.     public function setPdfOdr(MediaPdfOdr $pdfOdrs): Odr
  526.     {
  527.         $this->pdfOdrs $pdfOdrs;
  528.         return $this;
  529.     }
  530.     public function addPdfOdr(MediaPdfOdr $pdfOdr)
  531.     {
  532.         if ($this->pdfOdrs->contains($pdfOdr)) {
  533.             return;
  534.         }
  535.         $this->pdfOdrs[] = $pdfOdr;
  536.         $pdfOdr->SetOdr($this);
  537.     }
  538.     /**
  539.      * @return string
  540.      */
  541.     public function getFirstStep(): ?string
  542.     {
  543.         return $this->firstStep;
  544.     }
  545.     public function setFirstStep(?string $firstStep): self
  546.     {
  547.         $this->firstStep $firstStep;
  548.         return $this;
  549.     }
  550.     /**
  551.      * @return string
  552.      */
  553.     public function getSecondStep(): ?string
  554.     {
  555.         return $this->secondStep;
  556.     }
  557.     public function setSecondStep(?string $secondStep): self
  558.     {
  559.         $this->secondStep $secondStep;
  560.         return $this;
  561.     }
  562.     /**
  563.      * @return string
  564.      */
  565.     public function getThirdStep(): ?string
  566.     {
  567.         return $this->thirdStep;
  568.     }
  569.     public function setThirdStep(?string $thirdStep): self
  570.     {
  571.         $this->thirdStep $thirdStep;
  572.         return $this;
  573.     }
  574.     /**
  575.      * @return string
  576.      */
  577.     public function getFourthStep(): ?string
  578.     {
  579.         return $this->fourthStep;
  580.     }
  581.     public function setFourthStep(?string $fourthStep): self
  582.     {
  583.         $this->fourthStep $fourthStep;
  584.         return $this;
  585.     }
  586.     /**
  587.      * @return string
  588.      */
  589.     public function getFifthStep(): ?string
  590.     {
  591.         return $this->fifthStep;
  592.     }
  593.     public function setFifthStep(?string $fifthStep): self
  594.     {
  595.         $this->fifthStep $fifthStep;
  596.         return $this;
  597.     }
  598.     public function getStock(): int
  599.     {
  600.         return $this->stock;
  601.     }
  602.     public function hasStock(): bool
  603.     {
  604.         return (bool)$this->stock;
  605.     }
  606.     public function setStock(int $stock): self
  607.     {
  608.         $this->stock $stock;
  609.         return $this;
  610.     }
  611.     public function getPercentage(): float
  612.     {
  613.         return $this->percentage;
  614.     }
  615.     public function setPercentage(string $percentage): self
  616.     {
  617.         $this->percentage $percentage;
  618.         return $this;
  619.     }
  620.     public function getDetails(): ?DetailsOdr
  621.     {
  622.         return $this->details;
  623.     }
  624.     public function setDetails(?DetailsOdr $details): self
  625.     {
  626.         $this->details $details;
  627.         return $this;
  628.     }
  629.     /**
  630.      * @return bool
  631.      */
  632.     public function isParticipated(): bool
  633.     {
  634.         return $this->participated;
  635.     }
  636.     /**
  637.      * @param bool $participated
  638.      * @return Odr
  639.      */
  640.     public function setParticipated(bool $participated): Odr
  641.     {
  642.         $this->participated $participated;
  643.         return $this;
  644.     }
  645.     public function decreaseStock()
  646.     {
  647.         $this->currentStock--;
  648.     }
  649.     public function getMaxParticipationPerMonth(): ?int
  650.     {
  651.         return $this->maxParticipationPerMonth;
  652.     }
  653.     public function setMaxParticipationPerMonth(int $maxParticipationPerMonth): self
  654.     {
  655.         $this->maxParticipationPerMonth PeriodicityOperationMultiOffer::getOperationMaxParticipationPerMonth($maxParticipationPerMonth$this->periodicity,
  656.                                                                                             $this->stock$this->billyStartDate$this->billyEndDate);
  657.         return $this;
  658.     }
  659.     public function getPeriodicity(): ?string
  660.     {
  661.         return $this->periodicity;
  662.     }
  663.     /**
  664.      * @throws Exception
  665.      */
  666.     public function setPeriodicity(string $periodicity): self
  667.     {
  668.         if (PeriodicityOperationMultiOffer::BILLY_PERIODICITY[$periodicity] ?? 0) {
  669.             $this->periodicity $periodicity;
  670.         } else {
  671.             throw new Exception(sprintf("Periodicity not found : %s"$periodicity));
  672.         }
  673.         return $this;
  674.     }
  675.     public function getCurrentStock(): int
  676.     {
  677.         return $this->currentStock;
  678.     }
  679.     public function setCurrentStock(int $currentStock): self
  680.     {
  681.         $this->currentStock $currentStock;
  682.         return $this;
  683.     }
  684. }