<?php
namespace App\Entity;
use App\Repository\PurchasesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=PurchasesRepository::class)
*/
class Purchases
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="datetime")
*/
private $date;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $amount;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $nb_products;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $amount_paid;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $amount_remaining;
/**
* @ORM\ManyToOne(targetEntity=Supplier::class, inversedBy="purchases")
* @ORM\JoinColumn(nullable=false)
*/
private $supplier;
/**
* @ORM\OneToMany(targetEntity=Stock::class, mappedBy="purchase")
*/
private $stocks;
/**
* @ORM\Column(type="string", length=255)
*/
private $target;
/**
* @ORM\Column(type="boolean")
*/
private $isSynch;
/**
* @ORM\Column(type="boolean")
*/
private $deleted = 0;
public function __construct()
{
$this->stocks = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getAmount(): ?float
{
return $this->amount;
}
public function setAmount(?float $amount): self
{
$this->amount = $amount;
return $this;
}
public function getNbProducts(): ?int
{
return $this->nb_products;
}
public function setNbProducts(?int $nb_products): self
{
$this->nb_products = $nb_products;
return $this;
}
public function getAmountPaid(): ?float
{
return $this->amount_paid;
}
public function setAmountPaid(?float $amount_paid): self
{
$this->amount_paid = $amount_paid;
return $this;
}
public function getAmountRemaining(): ?float
{
return $this->amount_remaining;
}
public function setAmountRemaining(?float $amount_remaining): self
{
$this->amount_remaining = $amount_remaining;
return $this;
}
public function getSupplier(): ?Supplier
{
return $this->supplier;
}
public function setSupplier(?Supplier $supplier): self
{
$this->supplier = $supplier;
return $this;
}
/**
* @return Collection<int, Stock>
*/
public function getStocks(): Collection
{
return $this->stocks;
}
public function addStock(Stock $stock): self
{
if (!$this->stocks->contains($stock)) {
$this->stocks[] = $stock;
$stock->setPurchase($this);
}
return $this;
}
public function removeStock(Stock $stock): self
{
if ($this->stocks->removeElement($stock)) {
// set the owning side to null (unless already changed)
if ($stock->getPurchase() === $this) {
$stock->setPurchase(null);
}
}
return $this;
}
/**
* @return mixed
*/
public function getTarget()
{
return $this->target;
}
/**
* @param mixed $target
*/
public function setTarget($target): void
{
$this->target = $target;
}
/**
* @return mixed
*/
public function getisSynch()
{
return $this->isSynch;
}
/**
* @param mixed $isSynch
*/
public function setisSynch($isSynch): void
{
$this->isSynch = $isSynch;
}
/**
* @return mixed
*/
public function getDeleted()
{
return $this->deleted;
}
/**
* @param mixed $deleted
*/
public function setDeleted($deleted): void
{
$this->deleted = $deleted;
}
}