<?php
namespace App\Entity;
use App\Repository\ItemsListComplaintRepository;
use DateTime;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ItemsListComplaintRepository::class)]
#[ORM\Table(name: 'items_list_complaint')]
class ItemsListComplaint {
#[ORM\Column(type: 'boolean')]
private bool $isDeleted = false;
#[ORM\Column(name: 'createdAt', type: 'datetime')]
private DateTime $createdAt;
#[ORM\OneToMany(targetEntity: ArchiveComplaint::class, mappedBy: 'itemsListComplaint', cascade: ['persist'])]
private Collection|array $archiveComplaints;
#[ORM\Id]
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id;
#[ORM\ManyToMany(targetEntity: Item::class, inversedBy: 'itemsListComplaints')]
private Collection|array $items;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $pdfFileName;
#[ORM\ManyToMany(targetEntity: PaymentMethod::class, inversedBy: 'itemsListComplaints')]
private Collection|array $paymentMethods;
#[ORM\Column(type: 'decimal', precision: 10, scale: 2, nullable: true)]
private ?float $cash = null;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $nonSavedItem = null;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $nonSavedPaymentMethod = null;
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'itemsListComplaints')]
#[ORM\JoinColumn(nullable: false)]
private User $user;
public function __construct() {
$this->createdAt = new DateTime();
$this->items = new \Doctrine\Common\Collections\ArrayCollection();
$this->paymentMethods = new \Doctrine\Common\Collections\ArrayCollection();
}
public function __toString() {
return "#" . $this->id . " - " . $this->createdAt->format("d/m/Y H:i");
}
/**
* Get id
*
* @return int
*/
public function getId() {
return $this->id;
}
/**
* Set cash
*
* @param string $cash
*
* @return ItemsListComplaint
*/
public function setCash($cash) {
$this->cash = $cash;
return $this;
}
/**
* Get cash
*
* @return string
*/
public function getCash() {
return $this->cash;
}
/**
* Set nonSavedItem
*
* @param string $nonSavedItem
*
* @return ItemsListComplaint
*/
public function setNonSavedItem($nonSavedItem) {
$this->nonSavedItem = $nonSavedItem;
return $this;
}
/**
* Get nonSavedItem
*
* @return string
*/
public function getNonSavedItem() {
return $this->nonSavedItem;
}
/**
* Set nonSavedPaymentMethod
*
* @param string $nonSavedPaymentMethod
*
* @return ItemsListComplaint
*/
public function setNonSavedPaymentMethod($nonSavedPaymentMethod) {
$this->nonSavedPaymentMethod = $nonSavedPaymentMethod;
return $this;
}
/**
* Get nonSavedPaymentMethod
*
* @return string
*/
public function getNonSavedPaymentMethod() {
return $this->nonSavedPaymentMethod;
}
/**
* Add item
*
* @param \App\Entity\Item $item
*
* @return ItemsListComplaint
*/
public function addItem(\App\Entity\Item $item) {
$this->items[] = $item;
return $this;
}
/**
* Remove item
*
* @param \App\Entity\Item $item
*/
public function removeItem(\App\Entity\Item $item) {
$this->items->removeElement($item);
}
/**
* Get items
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getItems() {
return $this->items;
}
/**
* Add paymentMethod
*
* @param \App\Entity\PaymentMethod $paymentMethod
*
* @return ItemsListComplaint
*/
public function addPaymentMethod(\App\Entity\PaymentMethod $paymentMethod) {
$this->paymentMethods[] = $paymentMethod;
return $this;
}
/**
* Remove paymentMethod
*
* @param \App\Entity\PaymentMethod $paymentMethod
*/
public function removePaymentMethod(\App\Entity\PaymentMethod $paymentMethod) {
$this->paymentMethods->removeElement($paymentMethod);
}
/**
* Get paymentMethods
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPaymentMethods() {
return $this->paymentMethods;
}
/**
* Set user
*
* @param \App\Entity\User $user
*
* @return ItemsListComplaint
*/
public function setUser(\App\Entity\User $user) {
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \App\Entity\User
*/
public function getUser() {
return $this->user;
}
/**
* Set createdAt
*
* @param DateTime $createdAt
*
* @return ItemsListComplaint
*/
public function setCreatedAt($createdAt) {
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt() {
return $this->createdAt;
}
/**
* Set pdfFileName
*
* @param string $pdfFileName
*
* @return ItemsListComplaint
*/
public function setPdfFileName($pdfFileName) {
$this->pdfFileName = $pdfFileName;
return $this;
}
/**
* Get pdfFileName
*
* @return string
*/
public function getPdfFileName() {
return $this->pdfFileName;
}
public function getPdfFileNameWithExtention(): string
{
return $this->pdfFileName . '.pdf';
}
/**
* Add archiveComplaint
*
* @param \App\Entity\ArchiveComplaint $archiveComplaint
*
* @return ItemsListComplaint
*/
public function addArchiveComplaint(\App\Entity\ArchiveComplaint $archiveComplaint) {
$this->archiveComplaints[] = $archiveComplaint;
return $this;
}
/**
* Remove archiveComplaint
*
* @param \App\Entity\ArchiveComplaint $archiveComplaint
*/
public function removeArchiveComplaint(\App\Entity\ArchiveComplaint $archiveComplaint) {
$this->archiveComplaints->removeElement($archiveComplaint);
}
/**
* Get archiveComplaints
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getArchiveComplaints() {
return $this->archiveComplaints;
}
/**
* Set isDeleted
*
* @param boolean $isDeleted
*
* @return ItemsListComplaint
*/
public function setIsDeleted($isDeleted)
{
$this->isDeleted = $isDeleted;
return $this;
}
/**
* Get isDeleted
*
* @return boolean
*/
public function getIsDeleted()
{
return $this->isDeleted;
}
}