<?php
namespace App\Entity;
use App\Repository\StockWarehouseRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=StockWarehouseRepository::class)
*/
class StockWarehouse
{
public const TYPE_APPROVISIONNEMENT = 'APPROVISIONNEMENT';
public const TYPE_DISTRIBUTION = 'DISTRIBUTION';
public const TYPES = [
self::TYPE_APPROVISIONNEMENT => self::TYPE_APPROVISIONNEMENT,
self::TYPE_DISTRIBUTION => self::TYPE_DISTRIBUTION,
];
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=128)
*/
private $name;
/**
* @ORM\Column(type="string", length=60, nullable=true)
*/
private $type;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $location;
/**
* @ORM\Column(type="string", length=60, nullable=true)
*/
private $phone;
/**
* @ORM\ManyToOne(targetEntity=Establishment::class, inversedBy="stockWarehouses")
* @ORM\JoinColumn(nullable=false)
*/
private $establishment;
/**
* @ORM\OneToMany(targetEntity=StockMovement::class, mappedBy="stockWarehouse")
*/
private $stockMovements;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $created_at;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $updated_at;
/**
* @ORM\Column(type="integer")
*/
private $created_by;
/**
* @ORM\Column(type="integer")
*/
private $updated_by;
/**
* @ORM\OneToMany(targetEntity=StockDeliveryNote::class, mappedBy="stockWarehouse")
*/
private $stockDeliveryNotes;
/**
* @ORM\OneToMany(targetEntity=StockReceptionVoucher::class, mappedBy="stockWarehouse")
*/
private $stockReceptionVouchers;
/**
* @ORM\OneToMany(targetEntity=StockExitSlip::class, mappedBy="stockWarehouse")
*/
private $stockExitSlips;
/**
* @ORM\OneToMany(targetEntity=Stockinventory::class, mappedBy="stockWarehouse")
*/
private $stockinventories;
/**
* @ORM\OneToMany(targetEntity=StockProductEntry::class, mappedBy="stockWarehouse")
*/
private $stockProductEntries;
/**
* @ORM\OneToMany(targetEntity=Stocktransfer::class, mappedBy="stockFromWarehouse")
*/
private $stockFromTransfers;
/**
* @ORM\OneToMany(targetEntity=Stocktransfer::class, mappedBy="stockToWarehouse")
*/
private $stockToTransfers;
/**
* @ORM\OneToMany(targetEntity=StockProductOut::class, mappedBy="stockWarehouse")
*/
private $stockProductOuts;
/**
* @ORM\OneToMany(targetEntity=StockProviderKitEntry::class, mappedBy="stockWarehouse")
*/
private $stockProviderKitEntries;
/**
* @ORM\OneToMany(targetEntity=StockStudentKitEntry::class, mappedBy="stockWarehouse")
*/
private $stockStudentKitEntries;
/**
* @ORM\OneToMany(targetEntity=StockKitOut::class, mappedBy="stockWarehouse")
*/
private $stockKitOuts;
public function __construct()
{
$this->type = self::TYPE_APPROVISIONNEMENT;
$this->stockMovements = new ArrayCollection();
$this->stockDeliveryNotes = new ArrayCollection();
$this->stockReceptionVouchers = new ArrayCollection();
$this->stockExitSlips = new ArrayCollection();
$this->stockinventories = new ArrayCollection();
$this->stockProductEntries = new ArrayCollection();
$this->stockFromTransfers = new ArrayCollection();
$this->stockToTransfers = new ArrayCollection();
$this->stockProductOuts = new ArrayCollection();
$this->stockProviderKitEntries = new ArrayCollection();
$this->stockStudentKitEntries = new ArrayCollection();
$this->stockKitOuts = new ArrayCollection();
}
public function __toString(): string
{
return $this->name;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getLocation(): ?string
{
return $this->location;
}
public function setLocation(?string $location): self
{
$this->location = $location;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getEstablishment(): ?Establishment
{
return $this->establishment;
}
public function setEstablishment(?Establishment $establishment): self
{
$this->establishment = $establishment;
return $this;
}
/**
* @return Collection|StockMovement[]
*/
public function getStockMovements(): Collection
{
return $this->stockMovements;
}
public function addStockMovement(StockMovement $stockMovement): self
{
if (!$this->stockMovements->contains($stockMovement)) {
$this->stockMovements[] = $stockMovement;
$stockMovement->setStockWarehouse($this);
}
return $this;
}
public function removeStockMovement(StockMovement $stockMovement): self
{
if ($this->stockMovements->removeElement($stockMovement)) {
// set the owning side to null (unless already changed)
if ($stockMovement->getStockWarehouse() === $this) {
$stockMovement->setStockWarehouse(null);
}
}
return $this;
}
/**
* @return Collection|StockDeliveryNote[]
*/
public function getStockDeliveryNotes(): Collection
{
return $this->stockDeliveryNotes;
}
public function addStockDeliveryNote(StockDeliveryNote $stockDeliveryNote): self
{
if (!$this->stockDeliveryNotes->contains($stockDeliveryNote)) {
$this->stockDeliveryNotes[] = $stockDeliveryNote;
$stockDeliveryNote->setStockWarehouse($this);
}
return $this;
}
public function removeStockDeliveryNote(StockDeliveryNote $stockDeliveryNote): self
{
if ($this->stockDeliveryNotes->removeElement($stockDeliveryNote)) {
// set the owning side to null (unless already changed)
if ($stockDeliveryNote->getStockWarehouse() === $this) {
$stockDeliveryNote->setStockWarehouse(null);
}
}
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updated_at;
}
public function setUpdatedAt(\DateTimeImmutable $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
public function getCreatedBy(): ?int
{
return $this->created_by;
}
public function setCreatedBy(int $created_by): self
{
$this->created_by = $created_by;
return $this;
}
public function getUpdatedBy(): ?int
{
return $this->updated_by;
}
public function setUpdatedBy(int $updated_by): self
{
$this->updated_by = $updated_by;
return $this;
}
/**
* @return Collection|StockReceptionVoucher[]
*/
public function getStockReceptionVouchers(): Collection
{
return $this->stockReceptionVouchers;
}
public function addStockReceptionVoucher(StockReceptionVoucher $stockReceptionVoucher): self
{
if (!$this->stockReceptionVouchers->contains($stockReceptionVoucher)) {
$this->stockReceptionVouchers[] = $stockReceptionVoucher;
$stockReceptionVoucher->setStockWarehouse($this);
}
return $this;
}
public function removeStockReceptionVoucher(StockReceptionVoucher $stockReceptionVoucher): self
{
if ($this->stockReceptionVouchers->removeElement($stockReceptionVoucher)) {
// set the owning side to null (unless already changed)
if ($stockReceptionVoucher->getStockWarehouse() === $this) {
$stockReceptionVoucher->setStockWarehouse(null);
}
}
return $this;
}
/**
* @return Collection|StockExitSlip[]
*/
public function getStockExitSlips(): Collection
{
return $this->stockExitSlips;
}
public function addStockExitSlip(StockExitSlip $stockExitSlip): self
{
if (!$this->stockExitSlips->contains($stockExitSlip)) {
$this->stockExitSlips[] = $stockExitSlip;
$stockExitSlip->setStockWarehouse($this);
}
return $this;
}
public function removeStockExitSlip(StockExitSlip $stockExitSlip): self
{
if ($this->stockExitSlips->removeElement($stockExitSlip)) {
// set the owning side to null (unless already changed)
if ($stockExitSlip->getStockWarehouse() === $this) {
$stockExitSlip->setStockWarehouse(null);
}
}
return $this;
}
/**
* @return Collection|Stockinventory[]
*/
public function getStockinventories(): Collection
{
return $this->stockinventories;
}
public function addStockinventory(Stockinventory $stockinventory): self
{
if (!$this->stockinventories->contains($stockinventory)) {
$this->stockinventories[] = $stockinventory;
$stockinventory->setStockWarehouse($this);
}
return $this;
}
public function removeStockinventory(Stockinventory $stockinventory): self
{
if ($this->stockinventories->removeElement($stockinventory)) {
// set the owning side to null (unless already changed)
if ($stockinventory->getStockWarehouse() === $this) {
$stockinventory->setStockWarehouse(null);
}
}
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
/**
* @return Collection|StockProductEntry[]
*/
public function getStockProductEntries(): Collection
{
return $this->stockProductEntries;
}
public function addStockProductEntry(StockProductEntry $stockProductEntry): self
{
if (!$this->stockProductEntries->contains($stockProductEntry)) {
$this->stockProductEntries[] = $stockProductEntry;
$stockProductEntry->setStockWarehouse($this);
}
return $this;
}
public function removeStockProductEntry(StockProductEntry $stockProductEntry): self
{
if ($this->stockProductEntries->removeElement($stockProductEntry)) {
// set the owning side to null (unless already changed)
if ($stockProductEntry->getStockWarehouse() === $this) {
$stockProductEntry->setStockWarehouse(null);
}
}
return $this;
}
/**
* @return Collection|Stocktransfer[]
*/
public function getStockFromTransfers(): Collection
{
return $this->stockFromTransfers;
}
public function addStockFromTransfer(Stocktransfer $stockFromTransfer): self
{
if (!$this->stockFromTransfers->contains($stockFromTransfer)) {
$this->stockFromTransfers[] = $stockFromTransfer;
$stockFromTransfer->setStockFromWarehouse($this);
}
return $this;
}
public function removeStockFromTransfer(Stocktransfer $stockFromTransfer): self
{
if ($this->stockFromTransfers->removeElement($stockFromTransfer)) {
// set the owning side to null (unless already changed)
if ($stockFromTransfer->getStockFromWarehouse() === $this) {
$stockFromTransfer->setStockFromWarehouse(null);
}
}
return $this;
}
/**
* @return Collection|Stocktransfer[]
*/
public function getStockToTransfers(): Collection
{
return $this->stockToTransfers;
}
public function addStockToTransfer(Stocktransfer $stockToTransfer): self
{
if (!$this->stockToTransfers->contains($stockToTransfer)) {
$this->stockToTransfers[] = $stockToTransfer;
$stockToTransfer->setStockToWarehouse($this);
}
return $this;
}
public function removeStockToTransfer(Stocktransfer $stockToTransfer): self
{
if ($this->stockToTransfers->removeElement($stockToTransfer)) {
// set the owning side to null (unless already changed)
if ($stockToTransfer->getStockToWarehouse() === $this) {
$stockToTransfer->setStockToWarehouse(null);
}
}
return $this;
}
/**
* @return Collection|StockProductOut[]
*/
public function getStockProductOuts(): Collection
{
return $this->stockProductOuts;
}
public function addStockProductOut(StockProductOut $stockProductOut): self
{
if (!$this->stockProductOuts->contains($stockProductOut)) {
$this->stockProductOuts[] = $stockProductOut;
$stockProductOut->setStockWarehouse($this);
}
return $this;
}
public function removeStockProductOut(StockProductOut $stockProductOut): self
{
if ($this->stockProductOuts->removeElement($stockProductOut)) {
// set the owning side to null (unless already changed)
if ($stockProductOut->getStockWarehouse() === $this) {
$stockProductOut->setStockWarehouse(null);
}
}
return $this;
}
/**
* @return Collection|StockProviderKitEntry[]
*/
public function getStockProviderKitEntries(): Collection
{
return $this->stockProviderKitEntries;
}
public function addStockProviderKitEntry(StockProviderKitEntry $stockProviderKitEntry): self
{
if (!$this->stockProviderKitEntries->contains($stockProviderKitEntry)) {
$this->stockProviderKitEntries[] = $stockProviderKitEntry;
$stockProviderKitEntry->setStockWarehouse($this);
}
return $this;
}
public function removeStockProviderKitEntry(StockProviderKitEntry $stockProviderKitEntry): self
{
if ($this->stockProviderKitEntries->removeElement($stockProviderKitEntry)) {
// set the owning side to null (unless already changed)
if ($stockProviderKitEntry->getStockWarehouse() === $this) {
$stockProviderKitEntry->setStockWarehouse(null);
}
}
return $this;
}
/**
* @return Collection|StockStudentKitEntry[]
*/
public function getStockStudentKitEntries(): Collection
{
return $this->stockStudentKitEntries;
}
public function addStockStudentKitEntry(StockStudentKitEntry $stockStudentKitEntry): self
{
if (!$this->stockStudentKitEntries->contains($stockStudentKitEntry)) {
$this->stockStudentKitEntries[] = $stockStudentKitEntry;
$stockStudentKitEntry->setStockWarehouse($this);
}
return $this;
}
public function removeStockStudentKitEntry(StockStudentKitEntry $stockStudentKitEntry): self
{
if ($this->stockStudentKitEntries->removeElement($stockStudentKitEntry)) {
// set the owning side to null (unless already changed)
if ($stockStudentKitEntry->getStockWarehouse() === $this) {
$stockStudentKitEntry->setStockWarehouse(null);
}
}
return $this;
}
/**
* @return Collection|StockKitOut[]
*/
public function getStockKitOuts(): Collection
{
return $this->stockKitOuts;
}
public function addStockKitOut(StockKitOut $stockKitOut): self
{
if (!$this->stockKitOuts->contains($stockKitOut)) {
$this->stockKitOuts[] = $stockKitOut;
$stockKitOut->setStockWarehouse($this);
}
return $this;
}
public function removeStockKitOut(StockKitOut $stockKitOut): self
{
if ($this->stockKitOuts->removeElement($stockKitOut)) {
// set the owning side to null (unless already changed)
if ($stockKitOut->getStockWarehouse() === $this) {
$stockKitOut->setStockWarehouse(null);
}
}
return $this;
}
}