<?php
namespace App\Entity;
use App\Repository\StockExitSlipRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=StockExitSlipRepository::class)
*/
class StockExitSlip
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=60)
*/
private $code;
/**
* @ORM\ManyToOne(targetEntity=StockWarehouse::class, inversedBy="stockExitSlips")
* @ORM\JoinColumn(nullable=false)
*/
private $stockWarehouse;
/**
* @ORM\ManyToOne(targetEntity=Establishment::class, inversedBy="stockExitSlips")
* @ORM\JoinColumn(nullable=false)
*/
private $establishment;
/**
* @ORM\ManyToOne(targetEntity=StockProduct::class, inversedBy="stockExitSlips")
* @ORM\JoinColumn(nullable=false)
*/
private $stockProduct;
/**
* @ORM\Column(type="float")
*/
private $quantity;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $reason;
/**
* @ORM\ManyToOne(targetEntity=RegistrationStudentRegistration::class, inversedBy="stockExitSlips")
*/
private $registrationStudentRegistration;
/**
* @ORM\ManyToOne(targetEntity=RhSalary::class, inversedBy="stockExitSlips")
*/
private $rhSalary;
/**
* @ORM\Column(type="boolean")
*/
private $is_validated;
/**
* @ORM\Column(type="date_immutable")
*/
private $create_date;
/**
* @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=StockMovement::class, mappedBy="stockExitSlip")
*/
private $stockMovements;
public function __construct()
{
$this->is_validated = false;
$this->create_date = new \DateTimeImmutable();
$this->quantity = 1;
$this->stockMovements = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getStockWarehouse(): ?StockWarehouse
{
return $this->stockWarehouse;
}
public function setStockWarehouse(?StockWarehouse $stockWarehouse): self
{
$this->stockWarehouse = $stockWarehouse;
return $this;
}
public function getEstablishment(): ?Establishment
{
return $this->establishment;
}
public function setEstablishment(?Establishment $establishment): self
{
$this->establishment = $establishment;
return $this;
}
public function getStockProduct(): ?StockProduct
{
return $this->stockProduct;
}
public function setStockProduct(?StockProduct $stockProduct): self
{
$this->stockProduct = $stockProduct;
return $this;
}
public function getReason(): ?string
{
return $this->reason;
}
public function setReason(?string $reason): self
{
$this->reason = $reason;
return $this;
}
public function getRegistrationStudentRegistration(): ?RegistrationStudentRegistration
{
return $this->registrationStudentRegistration;
}
public function setRegistrationStudentRegistration(?RegistrationStudentRegistration $registrationStudentRegistration): self
{
$this->registrationStudentRegistration = $registrationStudentRegistration;
return $this;
}
public function getRhSalary(): ?RhSalary
{
return $this->rhSalary;
}
public function setRhSalary(?RhSalary $rhSalary): self
{
$this->rhSalary = $rhSalary;
return $this;
}
public function getIsValidated(): ?bool
{
return $this->is_validated;
}
public function setIsValidated(bool $is_validated): self
{
$this->is_validated = $is_validated;
return $this;
}
public function getCreateDate(): ?\DateTimeImmutable
{
return $this->create_date;
}
public function setCreateDate(\DateTimeImmutable $create_date): self
{
$this->create_date = $create_date;
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;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getQuantity(): ?float
{
return $this->quantity;
}
public function setQuantity(float $quantity): self
{
$this->quantity = $quantity;
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->setStockExitSlip($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->getStockExitSlip() === $this) {
$stockMovement->setStockExitSlip(null);
}
}
return $this;
}
}