<?php
namespace App\Entity;
use App\Utils\ExtendedEntity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\InquiryRepository")
*/
class Inquiry
{
use ExtendedEntity;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Customer", inversedBy="inquiries")
* @ORM\JoinColumn(nullable=false)
*/
private $recipient;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\CustomerInvoiceAddress", inversedBy="inquiries")
* @ORM\JoinColumn(nullable=true)
*/
private $invoiceAddress;
/**
* @ORM\Column(type="datetime")
*/
private $expirationDate;
/**
* @ORM\Column(type="string", length=128)
*/
private $status = 'new';
/**
* @ORM\OneToMany(targetEntity="App\Entity\Offer", mappedBy="inquiry")
*/
private $offers;
/**
* @ORM\OneToMany(targetEntity="App\Entity\InquiryDiscussionEntry", mappedBy="inquiry")
*/
private $inquiryDiscussionEntries;
/**
* @ORM\Column(type="string", length=17)
*/
private $vin;
/**
* @ORM\Column(type="string", length=64)
*/
private $model;
/**
* @ORM\Column(type="string", length=8)
*/
private $registrationNumber;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $notices;
/**
* @ORM\OneToMany(targetEntity="App\Entity\InquiryFile", mappedBy="inquiry", cascade={"persist"})
*/
private $inquiryFiles;
/**
* @ORM\OneToOne(targetEntity="App\Entity\InquiryFile", cascade={"persist", "remove"})
*/
private $vinPhoto;
/**
* @ORM\OneToOne(targetEntity="App\Entity\InquiryFile", cascade={"persist", "remove"})
*/
private $estimateFile;
/**
* @ORM\Column(type="boolean")
*/
private $archived = false;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Make")
* @ORM\JoinColumn(nullable=false)
*/
private $make;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $fileUploadId;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $noticesFV;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\CustomerAddress")
* @ORM\JoinColumn(nullable=true)
*/
private $customerAddress;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Customer", orphanRemoval=true, inversedBy="choosedForInquiries")
*/
private $choosedSuppliers;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $partsReceivedDate;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $partsIssuedDate;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
private $isPartsReceived;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
private $isPartsIssued;
/**
* @ORM\OneToMany(targetEntity="App\Entity\InquirySupplier", mappedBy="inquiry")
*/
private $inquirySuppliers;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private $buyerStatus = null;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private $sellerStatus = null;
/**
* @ORM\OneToMany(targetEntity="App\Entity\PrivateMessage", mappedBy="inquiry")
*/
private $privateMessages;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\ContactPerson")
* @ORM\JoinColumn(nullable=true)
*/
private $contactPerson;
public function __construct()
{
$this->offers = new ArrayCollection();
$this->inquiryDiscussionEntries = new ArrayCollection();
$this->inquiryFiles = new ArrayCollection();
$this->choosedSuppliers = new ArrayCollection();
$this->fileUploadId = uniqid('inquiry_');
$this->isPartsIssued = false;
$this->isPartsReceived = false;
$this->inquirySuppliers = new ArrayCollection();
$this->privateMessages = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId($id): void
{
$this->id = $id;
}
public function getRecipient(): ?Customer
{
return $this->recipient;
}
public function setRecipient(?Customer $recipient): self
{
$this->recipient = $recipient;
return $this;
}
public function getExpirationDate(): ?\DateTimeInterface
{
return $this->expirationDate;
}
public function setExpirationDate(?\DateTimeInterface $expirationDate): self
{
if ($expirationDate !== null) {
$this->expirationDate = clone $expirationDate;
} else {
$this->expirationDate = $expirationDate;
}
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection|Offer[]
*/
public function getOffers(): Collection
{
return $this->offers;
}
public function addOffer(Offer $offer): self
{
if (!$this->offers->contains($offer)) {
$this->offers[] = $offer;
$offer->setInquiry($this);
}
return $this;
}
public function removeOffer(Offer $offer): self
{
if ($this->offers->contains($offer)) {
$this->offers->removeElement($offer);
// set the owning side to null (unless already changed)
if ($offer->getInquiry() === $this) {
$offer->setInquiry(null);
}
}
return $this;
}
public function setOffers($offers)
{
$this->offers = $offers;
}
/**
* @return Collection|InquiryDiscussionEntry[]
*/
public function getInquiryDiscussionEntries(): Collection
{
return $this->inquiryDiscussionEntries;
}
public function addInquiryDiscussionEntry(InquiryDiscussionEntry $inquiryDiscussionEntry): self
{
if (!$this->inquiryDiscussionEntries->contains($inquiryDiscussionEntry)) {
$this->inquiryDiscussionEntries[] = $inquiryDiscussionEntry;
$inquiryDiscussionEntry->setInquiry($this);
}
return $this;
}
public function removeInquiryDiscussionEntry(InquiryDiscussionEntry $inquiryDiscussionEntry): self
{
if ($this->inquiryDiscussionEntries->contains($inquiryDiscussionEntry)) {
$this->inquiryDiscussionEntries->removeElement($inquiryDiscussionEntry);
// set the owning side to null (unless already changed)
if ($inquiryDiscussionEntry->getInquiry() === $this) {
$inquiryDiscussionEntry->setInquiry(null);
}
}
return $this;
}
public function setInquiryDiscussionEntries($discussionEntries)
{
$this->inquiryDiscussionEntries = $discussionEntries;
}
public function getVin(): ?string
{
return $this->vin;
}
public function setVin(?string $vin): self
{
$this->vin = $vin;
return $this;
}
public function getModel(): ?string
{
return $this->model;
}
public function setModel(string $model): self
{
$this->model = $model;
return $this;
}
public function getRegistrationNumber(): ?string
{
return $this->registrationNumber;
}
public function setRegistrationNumber(string $registrationNumber): self
{
$this->registrationNumber = $registrationNumber;
return $this;
}
public function getNotices(): ?string
{
return $this->notices;
}
public function setNotices(?string $notices): self
{
$this->notices = $notices;
return $this;
}
/**
* @return Collection|InquiryFile[]
*/
public function getInquiryFiles(): Collection
{
return $this->inquiryFiles;
}
public function setInquiryFiles(ArrayCollection $inquiryFiles) : self
{
$this->inquiryFiles = $inquiryFiles;
return $this;
}
public function addInquiryFile($inquiryFile): self
{
/** @var InquiryFile $inquiryFile */
if (!$this->inquiryFiles->contains($inquiryFile)) {
$this->inquiryFiles[] = $inquiryFile;
if ($inquiryFile instanceof InquiryFile) {
$inquiryFile->setInquiry($this);
}
}
return $this;
}
public function removeInquiryFile($inquiryFile): self
{
/** @var InquiryFile $inquiryFile */
if ($this->inquiryFiles->contains($inquiryFile)) {
$this->inquiryFiles->removeElement($inquiryFile);
// set the owning side to null (unless already changed)
if ($inquiryFile->getInquiry() === $this) {
$inquiryFile->setInquiry(null);
}
}
return $this;
}
public function getVinPhoto()
{
return $this->vinPhoto;
}
public function setVinPhoto($vinPhoto): self
{
$this->vinPhoto = $vinPhoto;
return $this;
}
public function getEstimateFile()
{
return $this->estimateFile;
}
public function setEstimateFile($estimateFile): self
{
$this->estimateFile = $estimateFile;
return $this;
}
public function getArchived(): ?bool
{
return $this->archived;
}
public function setArchived(bool $archived): self
{
$this->archived = $archived;
return $this;
}
public function getMake(): ?Make
{
return $this->make;
}
public function setMake(?Make $make): self
{
$this->make = $make;
return $this;
}
public function getFileUploadId()
{
return $this->fileUploadId;
}
public function setFileUploadId($fileUploadId)
{
$this->fileUploadId = $fileUploadId;
}
/**
* @return bool
*/
public function getActive()
{
return $this->active;
}
/**
* @param bool $active
*/
public function setActive(bool $active)
{
$this->active = $active;
}
/**
* @return mixed
*/
public function getNoticesFV()
{
return $this->noticesFV;
}
/**
* @param mixed $noticesFV
* @return Inquiry
*/
public function setNoticesFV($noticesFV)
{
$this->noticesFV = $noticesFV;
return $this;
}
public function getCustomerAddress(): ?CustomerAddress
{
return $this->customerAddress;
}
public function setCustomerAddress(?CustomerAddress $customerAddress): self
{
$this->customerAddress = $customerAddress;
return $this;
}
/**
* @return Collection|Customer[]
*/
public function getChoosedSuppliers(): Collection
{
return $this->choosedSuppliers;
}
public function addChoosedSupplier(Customer $choosedSupplier): self
{
if (!$this->choosedSuppliers->contains($choosedSupplier)) {
$this->choosedSuppliers[] = $choosedSupplier;
}
return $this;
}
public function removeChoosedSupplier(Customer $choosedSupplier): self
{
if ($this->choosedSuppliers->contains($choosedSupplier)) {
$this->choosedSuppliers->removeElement($choosedSupplier);
}
return $this;
}
public function getPartsReceivedDate(): ?\DateTimeInterface
{
return $this->partsReceivedDate;
}
public function setPartsReceivedDate(?\DateTimeInterface $partsReceivedDate): self
{
$this->partsReceivedDate = $partsReceivedDate;
return $this;
}
public function getPartsIssuedDate(): ?\DateTimeInterface
{
return $this->partsIssuedDate;
}
public function setPartsIssuedDate(?\DateTimeInterface $partsIssuedDate): self
{
$this->partsIssuedDate = $partsIssuedDate;
return $this;
}
public function getIsPartsReceived(): ?bool
{
return $this->isPartsReceived;
}
public function setIsPartsReceived(bool $isPartsReceived): self
{
$this->isPartsReceived = $isPartsReceived;
return $this;
}
public function getIsPartsIssued(): ?bool
{
return $this->isPartsIssued;
}
public function setIsPartsIssued(bool $isPartsIssued): self
{
$this->isPartsIssued = $isPartsIssued;
return $this;
}
/**
* @return Collection|InquirySupplier[]
*/
public function getInquirySuppliers(): Collection
{
return $this->inquirySuppliers;
}
public function addInquirySupplier(InquirySupplier $inquirySupplier): self
{
if (!$this->inquirySuppliers->contains($inquirySupplier)) {
$this->inquirySuppliers[] = $inquirySupplier;
$inquirySupplier->setInquiry($this);
}
return $this;
}
public function removeInquirySupplier(InquirySupplier $inquirySupplier): self
{
if ($this->inquirySuppliers->contains($inquirySupplier)) {
$this->inquirySuppliers->removeElement($inquirySupplier);
// set the owning side to null (unless already changed)
if ($inquirySupplier->getInquiry() === $this) {
$inquirySupplier->setInquiry(null);
}
}
return $this;
}
public function getBuyerStatus()
{
return $this->buyerStatus;
}
public function setBuyerStatus($buyerStatus): void
{
$this->buyerStatus = $buyerStatus;
}
/**
* @return null
*/
public function getSellerStatus()
{
return $this->sellerStatus;
}
/**
* @param null $sellerStatus
*/
public function setSellerStatus($sellerStatus): void
{
$this->sellerStatus = $sellerStatus;
}
/**
* @return Collection|PrivateMessage[]
*/
public function getPrivateMessages(): Collection
{
return $this->privateMessages;
}
public function addPrivateMessage(PrivateMessage $privateMessage): self
{
if (!$this->privateMessages->contains($privateMessage)) {
$this->privateMessages[] = $privateMessage;
$privateMessage->setInquiry($this);
}
return $this;
}
public function removePrivateMessage(PrivateMessage $privateMessage): self
{
if ($this->privateMessages->contains($privateMessage)) {
$this->privateMessages->removeElement($privateMessage);
// set the owning side to null (unless already changed)
if ($privateMessage->getInquiry() === $this) {
$privateMessage->setInquiry(null);
}
}
return $this;
}
/**
* @return mixed
*/
public function getContactPerson()
{
return $this->contactPerson;
}
/**
* @param mixed $contactPerson
*/
public function setContactPerson($contactPerson): void
{
$this->contactPerson = $contactPerson;
}
/** @param mixed $invoiceAddress */
public function setInvoiceAddress($invoiceAddress): void
{
$this->invoiceAddress = $invoiceAddress;
}
/** @return mixed */
public function getInvoiceAddress()
{
return $this->invoiceAddress;
}
}