<?php
namespace App\Entity;
use App\Repository\CommandRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CommandRepository::class)
*/
class Command
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="float")
*/
private $totalAmount;
/**
* @ORM\OneToMany(targetEntity=CommandProduct::class, mappedBy="command")
*/
private $commandProducts;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="commands")
*/
private $client;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $chargeId;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $status;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $commandNumber;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $relaypoint;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $paymentType;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $lastPayAt;
/**
* @ORM\OneToMany(targetEntity=CommandPack::class, mappedBy="command", fetch="EAGER")
*/
private $commandPacks;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isAvis;
/**
* @ORM\OneToMany(targetEntity=Transfert::class, mappedBy="command")
*/
private $transferts;
/**
* @ORM\OneToMany(targetEntity=AppFee::class, mappedBy="command")
*/
private $appFees;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $totalFraisLivraison;
public function __construct()
{
$this->commandProducts = new ArrayCollection();
$this->createdAt = new \DateTime();
$this->commandPacks = new ArrayCollection();
$this->transferts = new ArrayCollection();
$this->appFees = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTotalAmount(): ?float
{
return $this->totalAmount;
}
public function setTotalAmount(float $totalAmount): self
{
$this->totalAmount = $totalAmount;
return $this;
}
/**
* @return Collection|CommandProduct[]
*/
public function getCommandProducts(): Collection
{
return $this->commandProducts;
}
public function addCommandProduct(CommandProduct $commandProduct): self
{
if (!$this->commandProducts->contains($commandProduct)) {
$this->commandProducts[] = $commandProduct;
$commandProduct->setCommand($this);
}
return $this;
}
public function removeCommandProduct(CommandProduct $commandProduct): self
{
if ($this->commandProducts->contains($commandProduct)) {
$this->commandProducts->removeElement($commandProduct);
// set the owning side to null (unless already changed)
if ($commandProduct->getCommand() === $this) {
$commandProduct->setCommand(null);
}
}
return $this;
}
public function getClient(): ?User
{
return $this->client;
}
public function setClient(?User $client): self
{
$this->client = $client;
return $this;
}
public function getChargeId(): ?string
{
return $this->chargeId;
}
public function setChargeId(?string $chargeId): self
{
$this->chargeId = $chargeId;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function getRelaypoint(): ?string
{
return $this->relaypoint;
}
public function setRelaypoint(?string $relaypoint): self
{
$this->relaypoint = $relaypoint;
return $this;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
public function getCommandNumber(): ?string
{
return $this->commandNumber;
}
public function setCommandNumber(?string $commandNumber): self
{
$this->commandNumber = $commandNumber;
return $this;
}
public function getPaymentType(): ?string
{
return $this->paymentType;
}
public function setPaymentType(?string $paymentType): self
{
$this->paymentType = $paymentType;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getLastPayAt(): ?\DateTimeInterface
{
return $this->lastPayAt;
}
public function setLastPayAt(?\DateTimeInterface $lastPayAt): self
{
$this->lastPayAt = $lastPayAt;
return $this;
}
/**
* @return Collection|CommandPack[]
*/
public function getCommandPacks(): Collection
{
return $this->commandPacks;
}
public function addCommandPack(CommandPack $commandPack): self
{
if (!$this->commandPacks->contains($commandPack)) {
$this->commandPacks[] = $commandPack;
$commandPack->setCommand($this);
}
return $this;
}
public function removeCommandPack(CommandPack $commandPack): self
{
if ($this->commandPacks->contains($commandPack)) {
$this->commandPacks->removeElement($commandPack);
// set the owning side to null (unless already changed)
if ($commandPack->getCommand() === $this) {
$commandPack->setCommand(null);
}
}
return $this;
}
public function getIsAvis(): ?bool
{
return $this->isAvis;
}
public function setIsAvis(?bool $isAvis): self
{
$this->isAvis = $isAvis;
return $this;
}
/**
* @return Collection<int, Transfert>
*/
public function getTransferts(): Collection
{
return $this->transferts;
}
public function addTransfert(Transfert $transfert): self
{
if (!$this->transferts->contains($transfert)) {
$this->transferts[] = $transfert;
$transfert->setCommand($this);
}
return $this;
}
public function removeTransfert(Transfert $transfert): self
{
if ($this->transferts->removeElement($transfert)) {
// set the owning side to null (unless already changed)
if ($transfert->getCommand() === $this) {
$transfert->setCommand(null);
}
}
return $this;
}
/**
* @return Collection<int, AppFee>
*/
public function getAppFees(): Collection
{
return $this->appFees;
}
public function addAppFee(AppFee $appFee): self
{
if (!$this->appFees->contains($appFee)) {
$this->appFees[] = $appFee;
$appFee->setCommand($this);
}
return $this;
}
public function removeAppFee(AppFee $appFee): self
{
if ($this->appFees->removeElement($appFee)) {
// set the owning side to null (unless already changed)
if ($appFee->getCommand() === $this) {
$appFee->setCommand(null);
}
}
return $this;
}
public function getTotalFraisLivraison(): ?float
{
return $this->totalFraisLivraison;
}
public function setTotalFraisLivraison(?float $totalFraisLivraison): self
{
$this->totalFraisLivraison = $totalFraisLivraison;
return $this;
}
}