<?php
namespace App\Entity;
use App\Repository\AgentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=AgentRepository::class)
*/
class Agent
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $email;
/**
* @ORM\Column(type="string", length=255)
*/
private $passwordToEmail;
/**
* @ORM\Column(type="integer", nullable=false)
*/
private $howManyMessages = 0;
/**
* @ORM\Column(type="string", length=255)
*/
private $firstname;
/**
* @ORM\Column(type="string", length=255)
*/
private $lastname;
/**
* @ORM\Column(type="string", length=255)
*/
private $password;
/**
* @ORM\Column(type="string", length=255)
*/
private $agentRole;
/**
* @ORM\Column(type="string", length=1023, nullable=true)
*/
private $imageUrl;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $emailAllowDate;
/**
* @ORM\OneToMany(targetEntity=Customer::class, mappedBy="agent")
*/
private $customers;
/**
* @ORM\OneToMany(targetEntity=Mail::class, mappedBy="agent")
*/
private $mails;
public function __construct()
{
$this->customers = new ArrayCollection();
$this->mails = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return mixed
*/
public function getEmail(): string
{
return $this->email;
}
public function setEmail($email): self
{
$this->email = $email;
return $this;
}
/**
* @return mixed
*/
public function getPasswordToEmail()
{
return $this->passwordToEmail;
}
/**
* @param mixed $passwordToEmail
*/
public function setPasswordToEmail($passwordToEmail): void
{
$this->passwordToEmail = $passwordToEmail;
}
/**
* @return mixed
*/
public function getHowManyMessages()
{
return $this->howManyMessages;
}
/**
* @param mixed $howManyMessages
*/
public function setHowManyMessages($howManyMessages): void
{
$this->howManyMessages = $howManyMessages;
}
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 getPassword(): ?string
{
return $this->password;
}
public function setPassword(string $password): self
{
$this->password = $password;
return $this;
}
public function getAgentRole(): ?string
{
return $this->agentRole;
}
public function setAgentRole($agentRole): self
{
$this->agentRole = $agentRole;
return $this;
}
public function getImageUrl()
{
return $this->imageUrl;
}
public function setImageUrl($imageUrl): self
{
$this->imageUrl = $imageUrl;
return $this;
}
/**
* @return Collection<int, Customer>
*/
public function getCustomers(): Collection
{
return $this->customers;
}
public function addCustomer(Customer $customer): self
{
if (!$this->customers->contains($customer)) {
$this->customers[] = $customer;
$customer->setAgent($this);
}
return $this;
}
public function removeCustomer(Customer $customer): self
{
if ($this->customers->removeElement($customer)) {
// set the owning side to null (unless already changed)
if ($customer->getAgent() === $this) {
$customer->setAgent(null);
}
}
return $this;
}
/**
* @return Collection<int, Customer>
*/
public function getMails(): Collection
{
return $this->mails;
}
public function addMail(Mail $email): self
{
if (!$this->mails->contains($email)) {
$this->mails[] = $email;
$email->setAgent($this);
}
return $this;
}
public function removeMail(Mail $email): self
{
if ($this->mails->removeElement($email)) {
// set the owning side to null (unless already changed)
if ($email->getAgent() === $this) {
$email->setAgent(null);
}
}
return $this;
}
/**
* @return mixed
*/
public function getEmailAllowDate()
{
return $this->emailAllowDate;
}
/**
* @param mixed $emailAllowDate
*/
public function setEmailAllowDate($emailAllowDate): void
{
$this->emailAllowDate = $emailAllowDate;
}
}