<?php
namespace App\Entity;
use App\Repository\OrdersRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=OrdersRepository::class)
*/
class Orders
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $idPunch = null;
/**
* @ORM\ManyToOne(targetEntity=Establishments::class, inversedBy="orders")
*/
private $establishment;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $comment = null;
/**
* @ORM\Column(type="boolean")
*/
private $delivered = false;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $deliveryDate = null;
/**
* @ORM\Column(type="boolean")
*/
private $validated = false;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $validatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=Users::class, inversedBy="ordersValidated")
*/
private $validatedBy;
/**
* @ORM\ManyToOne(targetEntity=OrderStatus::class, inversedBy="orders")
*/
private $status;
/**
* @ORM\OneToMany(targetEntity=OrderArticle::class, mappedBy="orderCart")
*/
private $orderArticles;
/**
* @ORM\Column(type="boolean")
*/
private $standard = false;
/**
* @ORM\ManyToOne(targetEntity=Users::class, inversedBy="orders")
*/
private $user;
/**
* @ORM\Column(type="datetime")
*/
private $lastPickupUpdateAt;
/**
* @ORM\ManyToOne(targetEntity=Users::class, inversedBy="lastPickupUpdateOrder")
*/
private $lastPickupUpdateBy;
/**
* @ORM\Column(type="boolean")
*/
private $deleted = false;
/**
* @ORM\OneToMany(targetEntity=Invoice::class, mappedBy="orderNumber")
*/
private $invoices;
/**
* @ORM\OneToMany(targetEntity=ArticleOrderOutOfStock::class, mappedBy="orders")
*/
private $articleOrderOutOfStocks;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isRead = false;
/**
* @ORM\Column(type="boolean", nullable=false)
*/
private $fromApp = true;
public function __construct()
{
$this->createdAt = New \DateTime();
$this->lastPickupUpdateAt = New \DateTime();
$this->orderArticles = new ArrayCollection();
$this->invoices = new ArrayCollection();
$this->articleOrderOutOfStocks = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getIdPunch(): ?int
{
return $this->idPunch;
}
public function setIdPunch(?int $idPunch): self
{
$this->idPunch = $idPunch;
return $this;
}
public function getEstablishment(): ?Establishments
{
return $this->establishment;
}
public function setEstablishment(?Establishments $establishment): self
{
$this->establishment = $establishment;
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
public function isDelivered(): ?bool
{
return $this->delivered;
}
public function setDelivered(bool $delivered): self
{
$this->delivered = $delivered;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getDeliveryDate(): ?\DateTimeInterface
{
return $this->deliveryDate;
}
public function setDeliveryDate(?\DateTimeInterface $deliveryDate): self
{
$this->deliveryDate = $deliveryDate;
return $this;
}
public function isValidated(): ?bool
{
return $this->validated;
}
public function setValidated(bool $validated): self
{
$this->validated = $validated;
return $this;
}
public function getValidatedAt(): ?\DateTimeInterface
{
return $this->validatedAt;
}
public function setValidatedAt(?\DateTimeInterface $validatedAt): self
{
$this->validatedAt = $validatedAt;
return $this;
}
public function getValidatedBy(): ?Users
{
return $this->validatedBy;
}
public function setValidatedBy(?Users $validatedBy): self
{
$this->validatedBy = $validatedBy;
return $this;
}
public function getStatus(): ?OrderStatus
{
return $this->status;
}
public function setStatus(?OrderStatus $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection<int, OrderArticle>
*/
public function getOrderArticles(): Collection
{
return $this->orderArticles;
}
public function addOrderArticle(OrderArticle $orderArticle): self
{
if (!$this->orderArticles->contains($orderArticle)) {
$this->orderArticles[] = $orderArticle;
$orderArticle->setOrderCart($this);
}
return $this;
}
public function removeOrderArticle(OrderArticle $orderArticle): self
{
if ($this->orderArticles->removeElement($orderArticle)) {
// set the owning side to null (unless already changed)
if ($orderArticle->getOrderCart() === $this) {
$orderArticle->setOrderCart(null);
}
}
return $this;
}
public function getStandard(): ?bool
{
return $this->standard;
}
public function setStandard(bool $standard): self
{
$this->standard = $standard;
return $this;
}
public function getUser(): ?Users
{
return $this->user;
}
public function setUser(?Users $user): self
{
$this->user = $user;
return $this;
}
public function getLastPickupUpdateAt(): ?\DateTimeInterface
{
return $this->lastPickupUpdateAt;
}
public function setLastPickupUpdateAt(\DateTimeInterface $lastPickupUpdateAt): self
{
$this->lastPickupUpdateAt = $lastPickupUpdateAt;
return $this;
}
public function getLastPickupUpdateBy(): ?Users
{
return $this->lastPickupUpdateBy;
}
public function setLastPickupUpdateBy(?Users $lastPickupUpdateBy): self
{
$this->lastPickupUpdateBy = $lastPickupUpdateBy;
return $this;
}
public function isDeleted(): ?bool
{
return $this->deleted;
}
public function setDeleted(bool $deleted): self
{
$this->deleted = $deleted;
return $this;
}
/**
* @return Collection<int, Invoice>
*/
public function getInvoices(): Collection
{
return $this->invoices;
}
public function addInvoice(Invoice $invoice): self
{
if (!$this->invoices->contains($invoice)) {
$this->invoices[] = $invoice;
$invoice->setOrderNumber($this);
}
return $this;
}
public function removeInvoice(Invoice $invoice): self
{
if ($this->invoices->removeElement($invoice)) {
// set the owning side to null (unless already changed)
if ($invoice->getOrderNumber() === $this) {
$invoice->setOrderNumber(null);
}
}
return $this;
}
/**
* @return Collection<int, ArticleOrderOutOfStock>
*/
public function getArticleOrderOutOfStocks(): Collection
{
return $this->articleOrderOutOfStocks;
}
public function addArticleOrderOutOfStock(ArticleOrderOutOfStock $articleOrderOutOfStock): self
{
if (!$this->articleOrderOutOfStocks->contains($articleOrderOutOfStock)) {
$this->articleOrderOutOfStocks[] = $articleOrderOutOfStock;
$articleOrderOutOfStock->setOrder($this);
}
return $this;
}
public function removeArticleOrderOutOfStock(ArticleOrderOutOfStock $articleOrderOutOfStock): self
{
if ($this->articleOrderOutOfStocks->removeElement($articleOrderOutOfStock)) {
// set the owning side to null (unless already changed)
if ($articleOrderOutOfStock->getOrder() === $this) {
$articleOrderOutOfStock->setOrder(null);
}
}
return $this;
}
public function isIsRead(): ?bool
{
return $this->isRead;
}
public function setIsRead(?bool $isRead): self
{
$this->isRead = $isRead;
return $this;
}
public function isFromApp(): ?bool
{
return $this->fromApp;
}
public function setFromApp(?bool $fromApp): self
{
$this->fromApp = $fromApp;
return $this;
}
}