<?php
namespace App\Entity;
use App\Repository\CustomerRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CustomerRepository::class)
*/
class Customer
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $phone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $firstname;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $lastname;
/**
* @ORM\Column(type="string", length=255)
*/
private $customerType;
/**
* @ORM\Column(type="string", length=255)
*/
private $status;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $addDate;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $reservedTo;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $contractDate;
/**
* @ORM\OneToMany(targetEntity=CustomerComment::class, mappedBy="customer", orphanRemoval=true)
*/
private $customerComments;
/**
* @ORM\ManyToOne(targetEntity=Agent::class, inversedBy="customers")
*/
private $agent;
/**
* @ORM\Column(type="string", length=511, nullable=true)
*/
private $link;
/**
* @var transient
*/
private $displayNumber;
/**
* @var transient
*/
private $displayNumberToCall;
/**
* @var transient
*/
private $action;
public function __construct()
{
$this->customerComments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getFirstname(): ?string
{
return $this->firstname;
}
public function setFirstname(?string $firstname): self
{
$this->firstname = $firstname;
return $this;
}
public function getLastname(): ?string
{
return $this->lastname;
}
public function setLastname(?string $lastname): self
{
$this->lastname = $lastname;
return $this;
}
public function getCustomerType(): ?string
{
return $this->customerType;
}
public function setCustomerType(string $customerType): self
{
$this->customerType = $customerType;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus($status): self
{
$this->status = $status;
return $this;
}
public function getLastComment(): string
{
return $this->getCustomerComments()->count() == 0 ? '' : $this->getCustomerComments()->get($this->getCustomerComments()->count() - 1)->getComment();
}
public function getReservedTo(): ?\DateTimeInterface
{
return $this->reservedTo;
}
public function getReservedToFormatted(): string
{
return $this->reservedTo == null ? '' : $this->reservedTo->format('Y-m-d');
}
public function getContractFormatted(): string
{
return $this->contractDate == null ? 'n/a' : $this->contractDate->format('Y-m-d');
}
public function getContractDateFormatted(): ?string
{
return $this->contractDate == null ? null : $this->contractDate->format('Y-m-d');
}
public function setReservedTo(?\DateTimeInterface $reservedTo): self
{
$this->reservedTo = $reservedTo;
return $this;
}
public function getContractDate()
{
return $this->contractDate;
}
public function setContractDate($contractDate): self
{
$this->contractDate = $contractDate;
return $this;
}
/**
* @return Collection<int, CustomerComment>
*/
public function getCustomerComments(): Collection
{
return $this->customerComments;
}
public function addCustomerComment(CustomerComment $customerComment): self
{
if (!$this->customerComments->contains($customerComment)) {
$this->customerComments[] = $customerComment;
$customerComment->setCustomer($this);
}
return $this;
}
public function removeCustomerComment(CustomerComment $customerComment): self
{
if ($this->customerComments->removeElement($customerComment)) {
// set the owning side to null (unless already changed)
if ($customerComment->getCustomer() === $this) {
$customerComment->setCustomer(null);
}
}
return $this;
}
public function getAgent(): ?Agent
{
return $this->agent;
}
public function setAgent(?Agent $agent): self
{
$this->agent = $agent;
return $this;
}
public function getLink(): ?string
{
return $this->link;
}
public function setLink(?string $link): self
{
$this->link = $link;
return $this;
}
public function getDisplayNumber()
{
return $this->displayNumber;
}
public function setDisplayNumber($displayNumber): void
{
$this->displayNumber = $displayNumber;
}
/**
* @return transient
*/
public function getDisplayNumberToCall()
{
return $this->displayNumberToCall;
}
/**
* @param transient $displayNumberToCall
*/
public function setDisplayNumberToCall($displayNumberToCall): void
{
$this->displayNumberToCall = $displayNumberToCall;
}
public function getAction()
{
return $this->action;
}
public function setAction($action): void
{
$this->action = $action;
}
/**
* @return mixed
*/
public function getAddDate()
{
return $this->addDate;
}
public function getAddDateFormatted(): string
{
return $this->addDate == null ? '' : $this->addDate->format('Y-m-d');
}
/**
* @param mixed $addDate
*/
public function setAddDate($addDate): void
{
$this->addDate = $addDate;
}
}