src/Entity/StockWarehouse.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\StockWarehouseRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=StockWarehouseRepository::class)
  9.  */
  10. class StockWarehouse
  11. {
  12.     public const TYPE_APPROVISIONNEMENT 'APPROVISIONNEMENT';
  13.     public const TYPE_DISTRIBUTION 'DISTRIBUTION';
  14.     public const TYPES = [
  15.         self::TYPE_APPROVISIONNEMENT => self::TYPE_APPROVISIONNEMENT,
  16.         self::TYPE_DISTRIBUTION => self::TYPE_DISTRIBUTION,
  17.     ];
  18.     /**
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @ORM\Column(type="string", length=128)
  26.      */
  27.     private $name;
  28.     /**
  29.      * @ORM\Column(type="string", length=60, nullable=true)
  30.      */
  31.     private $type;
  32.     /**
  33.      * @ORM\Column(type="string", length=255, nullable=true)
  34.      */
  35.     private $location;
  36.     /**
  37.      * @ORM\Column(type="string", length=60, nullable=true)
  38.      */
  39.     private $phone;
  40.     /**
  41.      * @ORM\ManyToOne(targetEntity=Establishment::class, inversedBy="stockWarehouses")
  42.      * @ORM\JoinColumn(nullable=false)
  43.      */
  44.     private $establishment;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity=StockMovement::class, mappedBy="stockWarehouse")
  47.      */
  48.     private $stockMovements;
  49.     /**
  50.      * @ORM\Column(type="datetime_immutable")
  51.     */
  52.     private $created_at;
  53.     /**
  54.      * @ORM\Column(type="datetime_immutable")
  55.      */
  56.     private $updated_at;
  57.     /**
  58.      * @ORM\Column(type="integer")
  59.      */
  60.     private $created_by;
  61.     /**
  62.      * @ORM\Column(type="integer")
  63.      */
  64.     private $updated_by;
  65.     /**
  66.      * @ORM\OneToMany(targetEntity=StockDeliveryNote::class, mappedBy="stockWarehouse")
  67.      */
  68.     private $stockDeliveryNotes;
  69.     /**
  70.      * @ORM\OneToMany(targetEntity=StockReceptionVoucher::class, mappedBy="stockWarehouse")
  71.      */
  72.     private $stockReceptionVouchers;
  73.     /**
  74.      * @ORM\OneToMany(targetEntity=StockExitSlip::class, mappedBy="stockWarehouse")
  75.      */
  76.     private $stockExitSlips;
  77.     /**
  78.      * @ORM\OneToMany(targetEntity=Stockinventory::class, mappedBy="stockWarehouse")
  79.      */
  80.     private $stockinventories;
  81.     /**
  82.      * @ORM\OneToMany(targetEntity=StockProductEntry::class, mappedBy="stockWarehouse")
  83.      */
  84.     private $stockProductEntries;
  85.     /**
  86.      * @ORM\OneToMany(targetEntity=Stocktransfer::class, mappedBy="stockFromWarehouse")
  87.      */
  88.     private $stockFromTransfers;
  89.     /**
  90.      * @ORM\OneToMany(targetEntity=Stocktransfer::class, mappedBy="stockToWarehouse")
  91.      */
  92.     private $stockToTransfers;
  93.     /**
  94.      * @ORM\OneToMany(targetEntity=StockProductOut::class, mappedBy="stockWarehouse")
  95.      */
  96.     private $stockProductOuts;
  97.     /**
  98.      * @ORM\OneToMany(targetEntity=StockProviderKitEntry::class, mappedBy="stockWarehouse")
  99.      */
  100.     private $stockProviderKitEntries;
  101.     /**
  102.      * @ORM\OneToMany(targetEntity=StockStudentKitEntry::class, mappedBy="stockWarehouse")
  103.      */
  104.     private $stockStudentKitEntries;
  105.     /**
  106.      * @ORM\OneToMany(targetEntity=StockKitOut::class, mappedBy="stockWarehouse")
  107.      */
  108.     private $stockKitOuts;
  109.     public function __construct()
  110.     {
  111.         $this->type self::TYPE_APPROVISIONNEMENT;
  112.         $this->stockMovements = new ArrayCollection();
  113.         $this->stockDeliveryNotes = new ArrayCollection();
  114.         $this->stockReceptionVouchers = new ArrayCollection();
  115.         $this->stockExitSlips = new ArrayCollection();
  116.         $this->stockinventories = new ArrayCollection();
  117.         $this->stockProductEntries = new ArrayCollection();
  118.         $this->stockFromTransfers = new ArrayCollection();
  119.         $this->stockToTransfers = new ArrayCollection();
  120.         $this->stockProductOuts = new ArrayCollection();
  121.         $this->stockProviderKitEntries = new ArrayCollection();
  122.         $this->stockStudentKitEntries = new ArrayCollection();
  123.         $this->stockKitOuts = new ArrayCollection();
  124.     }
  125.     public function __toString(): string
  126.     {
  127.         return $this->name;
  128.     }
  129.     public function getId(): ?int
  130.     {
  131.         return $this->id;
  132.     }
  133.     public function getName(): ?string
  134.     {
  135.         return $this->name;
  136.     }
  137.     public function setName(string $name): self
  138.     {
  139.         $this->name $name;
  140.         return $this;
  141.     }
  142.     public function getLocation(): ?string
  143.     {
  144.         return $this->location;
  145.     }
  146.     public function setLocation(?string $location): self
  147.     {
  148.         $this->location $location;
  149.         return $this;
  150.     }
  151.     public function getPhone(): ?string
  152.     {
  153.         return $this->phone;
  154.     }
  155.     public function setPhone(?string $phone): self
  156.     {
  157.         $this->phone $phone;
  158.         return $this;
  159.     }
  160.     public function getEstablishment(): ?Establishment
  161.     {
  162.         return $this->establishment;
  163.     }
  164.     public function setEstablishment(?Establishment $establishment): self
  165.     {
  166.         $this->establishment $establishment;
  167.         return $this;
  168.     }
  169.     /**
  170.      * @return Collection|StockMovement[]
  171.      */
  172.     public function getStockMovements(): Collection
  173.     {
  174.         return $this->stockMovements;
  175.     }
  176.     public function addStockMovement(StockMovement $stockMovement): self
  177.     {
  178.         if (!$this->stockMovements->contains($stockMovement)) {
  179.             $this->stockMovements[] = $stockMovement;
  180.             $stockMovement->setStockWarehouse($this);
  181.         }
  182.         return $this;
  183.     }
  184.     public function removeStockMovement(StockMovement $stockMovement): self
  185.     {
  186.         if ($this->stockMovements->removeElement($stockMovement)) {
  187.             // set the owning side to null (unless already changed)
  188.             if ($stockMovement->getStockWarehouse() === $this) {
  189.                 $stockMovement->setStockWarehouse(null);
  190.             }
  191.         }
  192.         return $this;
  193.     }
  194.     /**
  195.      * @return Collection|StockDeliveryNote[]
  196.      */
  197.     public function getStockDeliveryNotes(): Collection
  198.     {
  199.         return $this->stockDeliveryNotes;
  200.     }
  201.     public function addStockDeliveryNote(StockDeliveryNote $stockDeliveryNote): self
  202.     {
  203.         if (!$this->stockDeliveryNotes->contains($stockDeliveryNote)) {
  204.             $this->stockDeliveryNotes[] = $stockDeliveryNote;
  205.             $stockDeliveryNote->setStockWarehouse($this);
  206.         }
  207.         return $this;
  208.     }
  209.     public function removeStockDeliveryNote(StockDeliveryNote $stockDeliveryNote): self
  210.     {
  211.         if ($this->stockDeliveryNotes->removeElement($stockDeliveryNote)) {
  212.             // set the owning side to null (unless already changed)
  213.             if ($stockDeliveryNote->getStockWarehouse() === $this) {
  214.                 $stockDeliveryNote->setStockWarehouse(null);
  215.             }
  216.         }
  217.         return $this;
  218.     }
  219.     public function getCreatedAt(): ?\DateTimeImmutable
  220.     {
  221.         return $this->created_at;
  222.     }
  223.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  224.     {
  225.         $this->created_at $created_at;
  226.         return $this;
  227.     }
  228.     public function getUpdatedAt(): ?\DateTimeImmutable
  229.     {
  230.         return $this->updated_at;
  231.     }
  232.     public function setUpdatedAt(\DateTimeImmutable $updated_at): self
  233.     {
  234.         $this->updated_at $updated_at;
  235.         return $this;
  236.     }
  237.     public function getCreatedBy(): ?int
  238.     {
  239.         return $this->created_by;
  240.     }
  241.     public function setCreatedBy(int $created_by): self
  242.     {
  243.         $this->created_by $created_by;
  244.         return $this;
  245.     }
  246.     public function getUpdatedBy(): ?int
  247.     {
  248.         return $this->updated_by;
  249.     }
  250.     public function setUpdatedBy(int $updated_by): self
  251.     {
  252.         $this->updated_by $updated_by;
  253.         return $this;
  254.     }
  255.     /**
  256.      * @return Collection|StockReceptionVoucher[]
  257.      */
  258.     public function getStockReceptionVouchers(): Collection
  259.     {
  260.         return $this->stockReceptionVouchers;
  261.     }
  262.     public function addStockReceptionVoucher(StockReceptionVoucher $stockReceptionVoucher): self
  263.     {
  264.         if (!$this->stockReceptionVouchers->contains($stockReceptionVoucher)) {
  265.             $this->stockReceptionVouchers[] = $stockReceptionVoucher;
  266.             $stockReceptionVoucher->setStockWarehouse($this);
  267.         }
  268.         return $this;
  269.     }
  270.     public function removeStockReceptionVoucher(StockReceptionVoucher $stockReceptionVoucher): self
  271.     {
  272.         if ($this->stockReceptionVouchers->removeElement($stockReceptionVoucher)) {
  273.             // set the owning side to null (unless already changed)
  274.             if ($stockReceptionVoucher->getStockWarehouse() === $this) {
  275.                 $stockReceptionVoucher->setStockWarehouse(null);
  276.             }
  277.         }
  278.         return $this;
  279.     }
  280.     /**
  281.      * @return Collection|StockExitSlip[]
  282.      */
  283.     public function getStockExitSlips(): Collection
  284.     {
  285.         return $this->stockExitSlips;
  286.     }
  287.     public function addStockExitSlip(StockExitSlip $stockExitSlip): self
  288.     {
  289.         if (!$this->stockExitSlips->contains($stockExitSlip)) {
  290.             $this->stockExitSlips[] = $stockExitSlip;
  291.             $stockExitSlip->setStockWarehouse($this);
  292.         }
  293.         return $this;
  294.     }
  295.     public function removeStockExitSlip(StockExitSlip $stockExitSlip): self
  296.     {
  297.         if ($this->stockExitSlips->removeElement($stockExitSlip)) {
  298.             // set the owning side to null (unless already changed)
  299.             if ($stockExitSlip->getStockWarehouse() === $this) {
  300.                 $stockExitSlip->setStockWarehouse(null);
  301.             }
  302.         }
  303.         return $this;
  304.     }
  305.     /**
  306.      * @return Collection|Stockinventory[]
  307.      */
  308.     public function getStockinventories(): Collection
  309.     {
  310.         return $this->stockinventories;
  311.     }
  312.     public function addStockinventory(Stockinventory $stockinventory): self
  313.     {
  314.         if (!$this->stockinventories->contains($stockinventory)) {
  315.             $this->stockinventories[] = $stockinventory;
  316.             $stockinventory->setStockWarehouse($this);
  317.         }
  318.         return $this;
  319.     }
  320.     public function removeStockinventory(Stockinventory $stockinventory): self
  321.     {
  322.         if ($this->stockinventories->removeElement($stockinventory)) {
  323.             // set the owning side to null (unless already changed)
  324.             if ($stockinventory->getStockWarehouse() === $this) {
  325.                 $stockinventory->setStockWarehouse(null);
  326.             }
  327.         }
  328.         return $this;
  329.     }
  330.     public function getType(): ?string
  331.     {
  332.         return $this->type;
  333.     }
  334.     public function setType(string $type): self
  335.     {
  336.         $this->type $type;
  337.         return $this;
  338.     }
  339.     /**
  340.      * @return Collection|StockProductEntry[]
  341.      */
  342.     public function getStockProductEntries(): Collection
  343.     {
  344.         return $this->stockProductEntries;
  345.     }
  346.     public function addStockProductEntry(StockProductEntry $stockProductEntry): self
  347.     {
  348.         if (!$this->stockProductEntries->contains($stockProductEntry)) {
  349.             $this->stockProductEntries[] = $stockProductEntry;
  350.             $stockProductEntry->setStockWarehouse($this);
  351.         }
  352.         return $this;
  353.     }
  354.     public function removeStockProductEntry(StockProductEntry $stockProductEntry): self
  355.     {
  356.         if ($this->stockProductEntries->removeElement($stockProductEntry)) {
  357.             // set the owning side to null (unless already changed)
  358.             if ($stockProductEntry->getStockWarehouse() === $this) {
  359.                 $stockProductEntry->setStockWarehouse(null);
  360.             }
  361.         }
  362.         return $this;
  363.     }
  364.     /**
  365.      * @return Collection|Stocktransfer[]
  366.      */
  367.     public function getStockFromTransfers(): Collection
  368.     {
  369.         return $this->stockFromTransfers;
  370.     }
  371.     public function addStockFromTransfer(Stocktransfer $stockFromTransfer): self
  372.     {
  373.         if (!$this->stockFromTransfers->contains($stockFromTransfer)) {
  374.             $this->stockFromTransfers[] = $stockFromTransfer;
  375.             $stockFromTransfer->setStockFromWarehouse($this);
  376.         }
  377.         return $this;
  378.     }
  379.     public function removeStockFromTransfer(Stocktransfer $stockFromTransfer): self
  380.     {
  381.         if ($this->stockFromTransfers->removeElement($stockFromTransfer)) {
  382.             // set the owning side to null (unless already changed)
  383.             if ($stockFromTransfer->getStockFromWarehouse() === $this) {
  384.                 $stockFromTransfer->setStockFromWarehouse(null);
  385.             }
  386.         }
  387.         return $this;
  388.     }
  389.     /**
  390.      * @return Collection|Stocktransfer[]
  391.      */
  392.     public function getStockToTransfers(): Collection
  393.     {
  394.         return $this->stockToTransfers;
  395.     }
  396.     public function addStockToTransfer(Stocktransfer $stockToTransfer): self
  397.     {
  398.         if (!$this->stockToTransfers->contains($stockToTransfer)) {
  399.             $this->stockToTransfers[] = $stockToTransfer;
  400.             $stockToTransfer->setStockToWarehouse($this);
  401.         }
  402.         return $this;
  403.     }
  404.     public function removeStockToTransfer(Stocktransfer $stockToTransfer): self
  405.     {
  406.         if ($this->stockToTransfers->removeElement($stockToTransfer)) {
  407.             // set the owning side to null (unless already changed)
  408.             if ($stockToTransfer->getStockToWarehouse() === $this) {
  409.                 $stockToTransfer->setStockToWarehouse(null);
  410.             }
  411.         }
  412.         return $this;
  413.     }
  414.     /**
  415.      * @return Collection|StockProductOut[]
  416.      */
  417.     public function getStockProductOuts(): Collection
  418.     {
  419.         return $this->stockProductOuts;
  420.     }
  421.     public function addStockProductOut(StockProductOut $stockProductOut): self
  422.     {
  423.         if (!$this->stockProductOuts->contains($stockProductOut)) {
  424.             $this->stockProductOuts[] = $stockProductOut;
  425.             $stockProductOut->setStockWarehouse($this);
  426.         }
  427.         return $this;
  428.     }
  429.     public function removeStockProductOut(StockProductOut $stockProductOut): self
  430.     {
  431.         if ($this->stockProductOuts->removeElement($stockProductOut)) {
  432.             // set the owning side to null (unless already changed)
  433.             if ($stockProductOut->getStockWarehouse() === $this) {
  434.                 $stockProductOut->setStockWarehouse(null);
  435.             }
  436.         }
  437.         return $this;
  438.     }
  439.     /**
  440.      * @return Collection|StockProviderKitEntry[]
  441.      */
  442.     public function getStockProviderKitEntries(): Collection
  443.     {
  444.         return $this->stockProviderKitEntries;
  445.     }
  446.     public function addStockProviderKitEntry(StockProviderKitEntry $stockProviderKitEntry): self
  447.     {
  448.         if (!$this->stockProviderKitEntries->contains($stockProviderKitEntry)) {
  449.             $this->stockProviderKitEntries[] = $stockProviderKitEntry;
  450.             $stockProviderKitEntry->setStockWarehouse($this);
  451.         }
  452.         return $this;
  453.     }
  454.     public function removeStockProviderKitEntry(StockProviderKitEntry $stockProviderKitEntry): self
  455.     {
  456.         if ($this->stockProviderKitEntries->removeElement($stockProviderKitEntry)) {
  457.             // set the owning side to null (unless already changed)
  458.             if ($stockProviderKitEntry->getStockWarehouse() === $this) {
  459.                 $stockProviderKitEntry->setStockWarehouse(null);
  460.             }
  461.         }
  462.         return $this;
  463.     }
  464.     /**
  465.      * @return Collection|StockStudentKitEntry[]
  466.      */
  467.     public function getStockStudentKitEntries(): Collection
  468.     {
  469.         return $this->stockStudentKitEntries;
  470.     }
  471.     public function addStockStudentKitEntry(StockStudentKitEntry $stockStudentKitEntry): self
  472.     {
  473.         if (!$this->stockStudentKitEntries->contains($stockStudentKitEntry)) {
  474.             $this->stockStudentKitEntries[] = $stockStudentKitEntry;
  475.             $stockStudentKitEntry->setStockWarehouse($this);
  476.         }
  477.         return $this;
  478.     }
  479.     public function removeStockStudentKitEntry(StockStudentKitEntry $stockStudentKitEntry): self
  480.     {
  481.         if ($this->stockStudentKitEntries->removeElement($stockStudentKitEntry)) {
  482.             // set the owning side to null (unless already changed)
  483.             if ($stockStudentKitEntry->getStockWarehouse() === $this) {
  484.                 $stockStudentKitEntry->setStockWarehouse(null);
  485.             }
  486.         }
  487.         return $this;
  488.     }
  489.     /**
  490.      * @return Collection|StockKitOut[]
  491.      */
  492.     public function getStockKitOuts(): Collection
  493.     {
  494.         return $this->stockKitOuts;
  495.     }
  496.     public function addStockKitOut(StockKitOut $stockKitOut): self
  497.     {
  498.         if (!$this->stockKitOuts->contains($stockKitOut)) {
  499.             $this->stockKitOuts[] = $stockKitOut;
  500.             $stockKitOut->setStockWarehouse($this);
  501.         }
  502.         return $this;
  503.     }
  504.     public function removeStockKitOut(StockKitOut $stockKitOut): self
  505.     {
  506.         if ($this->stockKitOuts->removeElement($stockKitOut)) {
  507.             // set the owning side to null (unless already changed)
  508.             if ($stockKitOut->getStockWarehouse() === $this) {
  509.                 $stockKitOut->setStockWarehouse(null);
  510.             }
  511.         }
  512.         return $this;
  513.     }
  514. }