src/Entity/Customer.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CustomerRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CustomerRepository::class)
  9.  */
  10. class Customer
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255, nullable=true)
  20.      */
  21.     private $phone;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private $email;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $firstname;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $lastname;
  34.     /**
  35.      * @ORM\Column(type="string", length=255)
  36.      */
  37.     private $customerType;
  38.     /**
  39.      * @ORM\Column(type="string", length=255)
  40.      */
  41.     private $status;
  42.     /**
  43.      * @ORM\Column(type="date", nullable=true)
  44.      */
  45.     private $addDate;
  46.     /**
  47.      * @ORM\Column(type="date", nullable=true)
  48.      */
  49.     private $reservedTo;
  50.     /**
  51.      * @ORM\Column(type="date", nullable=true)
  52.      */
  53.     private $contractDate;
  54.     /**
  55.      * @ORM\OneToMany(targetEntity=CustomerComment::class, mappedBy="customer", orphanRemoval=true)
  56.      */
  57.     private $customerComments;
  58.     /**
  59.      * @ORM\ManyToOne(targetEntity=Agent::class, inversedBy="customers")
  60.      */
  61.     private $agent;
  62.     /**
  63.      * @ORM\Column(type="string", length=511, nullable=true)
  64.      */
  65.     private $link;
  66.     /**
  67.      * @var transient
  68.      */
  69.     private $displayNumber;
  70.     /**
  71.      * @var transient
  72.      */
  73.     private $displayNumberToCall;
  74.     /**
  75.      * @var transient
  76.      */
  77.     private $action;
  78.     public function __construct()
  79.     {
  80.         $this->customerComments = new ArrayCollection();
  81.     }
  82.     public function getId(): ?int
  83.     {
  84.         return $this->id;
  85.     }
  86.     public function getPhone(): ?string
  87.     {
  88.         return $this->phone;
  89.     }
  90.     public function setPhone(?string $phone): self
  91.     {
  92.         $this->phone $phone;
  93.         return $this;
  94.     }
  95.     public function getEmail(): ?string
  96.     {
  97.         return $this->email;
  98.     }
  99.     public function setEmail(?string $email): self
  100.     {
  101.         $this->email $email;
  102.         return $this;
  103.     }
  104.     public function getFirstname(): ?string
  105.     {
  106.         return $this->firstname;
  107.     }
  108.     public function setFirstname(?string $firstname): self
  109.     {
  110.         $this->firstname $firstname;
  111.         return $this;
  112.     }
  113.     public function getLastname(): ?string
  114.     {
  115.         return $this->lastname;
  116.     }
  117.     public function setLastname(?string $lastname): self
  118.     {
  119.         $this->lastname $lastname;
  120.         return $this;
  121.     }
  122.     public function getCustomerType(): ?string
  123.     {
  124.         return $this->customerType;
  125.     }
  126.     public function setCustomerType(string $customerType): self
  127.     {
  128.         $this->customerType $customerType;
  129.         return $this;
  130.     }
  131.     public function getStatus(): ?string
  132.     {
  133.         return $this->status;
  134.     }
  135.     public function setStatus($status): self
  136.     {
  137.         $this->status $status;
  138.         return $this;
  139.     }
  140.     public function getLastComment(): string
  141.     {
  142.         return $this->getCustomerComments()->count() == '' $this->getCustomerComments()->get($this->getCustomerComments()->count() - 1)->getComment();
  143.     }
  144.     public function getReservedTo(): ?\DateTimeInterface
  145.     {
  146.         return $this->reservedTo;
  147.     }
  148.     public function getReservedToFormatted(): string
  149.     {
  150.         return $this->reservedTo == null '' $this->reservedTo->format('Y-m-d');
  151.     }
  152.     public function getContractFormatted(): string
  153.     {
  154.         return $this->contractDate == null 'n/a' $this->contractDate->format('Y-m-d');
  155.     }
  156.     public function getContractDateFormatted(): ?string
  157.     {
  158.         return $this->contractDate == null null $this->contractDate->format('Y-m-d');
  159.     }
  160.     public function setReservedTo(?\DateTimeInterface $reservedTo): self
  161.     {
  162.         $this->reservedTo $reservedTo;
  163.         return $this;
  164.     }
  165.     public function getContractDate()
  166.     {
  167.         return $this->contractDate;
  168.     }
  169.     public function setContractDate($contractDate): self
  170.     {
  171.         $this->contractDate $contractDate;
  172.         return $this;
  173.     }
  174.     /**
  175.      * @return Collection<int, CustomerComment>
  176.      */
  177.     public function getCustomerComments(): Collection
  178.     {
  179.         return $this->customerComments;
  180.     }
  181.     public function addCustomerComment(CustomerComment $customerComment): self
  182.     {
  183.         if (!$this->customerComments->contains($customerComment)) {
  184.             $this->customerComments[] = $customerComment;
  185.             $customerComment->setCustomer($this);
  186.         }
  187.         return $this;
  188.     }
  189.     public function removeCustomerComment(CustomerComment $customerComment): self
  190.     {
  191.         if ($this->customerComments->removeElement($customerComment)) {
  192.             // set the owning side to null (unless already changed)
  193.             if ($customerComment->getCustomer() === $this) {
  194.                 $customerComment->setCustomer(null);
  195.             }
  196.         }
  197.         return $this;
  198.     }
  199.     public function getAgent(): ?Agent
  200.     {
  201.         return $this->agent;
  202.     }
  203.     public function setAgent(?Agent $agent): self
  204.     {
  205.         $this->agent $agent;
  206.         return $this;
  207.     }
  208.     public function getLink(): ?string
  209.     {
  210.         return $this->link;
  211.     }
  212.     public function setLink(?string $link): self
  213.     {
  214.         $this->link $link;
  215.         return $this;
  216.     }
  217.     public function getDisplayNumber()
  218.     {
  219.         return $this->displayNumber;
  220.     }
  221.     public function setDisplayNumber($displayNumber): void
  222.     {
  223.         $this->displayNumber $displayNumber;
  224.     }
  225.     /**
  226.      * @return transient
  227.      */
  228.     public function getDisplayNumberToCall()
  229.     {
  230.         return $this->displayNumberToCall;
  231.     }
  232.     /**
  233.      * @param transient $displayNumberToCall
  234.      */
  235.     public function setDisplayNumberToCall($displayNumberToCall): void
  236.     {
  237.         $this->displayNumberToCall $displayNumberToCall;
  238.     }
  239.     public function getAction()
  240.     {
  241.         return $this->action;
  242.     }
  243.     public function setAction($action): void
  244.     {
  245.         $this->action $action;
  246.     }
  247.     /**
  248.      * @return mixed
  249.      */
  250.     public function getAddDate()
  251.     {
  252.         return $this->addDate;
  253.     }
  254.     public function getAddDateFormatted(): string
  255.     {
  256.         return $this->addDate == null '' $this->addDate->format('Y-m-d');
  257.     }
  258.     /**
  259.      * @param mixed $addDate
  260.      */
  261.     public function setAddDate($addDate): void
  262.     {
  263.         $this->addDate $addDate;
  264.     }
  265. }