<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @ORM\Entity(repositoryClass="App\Repository\AgentsRepository")
* @ORM\Table(indexes={@ORM\Index(name="email", columns={"email"})})
*/
class Agents implements UserInterface, \Serializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=25)
*/
private $username;
/**
* @ORM\Column(type="string", length=64)
*/
private $password;
/**
* @ORM\Column(type="string", length=254, unique=true)
*/
private $email;
/**
* @ORM\Column(name="is_active", type="boolean")
*/
private $isActive = true;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateUpdated;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateInserted;
public function __construct()
{
// $this->isActive = true;
// may not be needed, see section on salt below
// $this->salt = md5(uniqid('', true));
}
public function getUsername()
{
return $this->username;
}
public function getSalt()
{
// you *may* need a real salt depending on your encoder
// see section on salt below
return null;
}
public function getPassword()
{
return $this->password;
}
public function getRoles()
{
return array('ROLE_AGENT');
}
public function eraseCredentials()
{
}
/** @see \Serializable::serialize() */
public function serialize()
{
return serialize(array(
$this->id,
$this->username,
$this->password,
// see section on salt below
// $this->salt,
));
}
/** @see \Serializable::unserialize() */
public function unserialize($serialized)
{
list (
$this->id,
$this->username,
$this->password,
// see section on salt below
// $this->salt
) = unserialize($serialized, array('allowed_classes' => false));
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set username.
*
* @param string $username
*
* @return Agents
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Set password.
*
* @param string $password
*
* @return Agents
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
/**
* Set email.
*
* @param string $email
*
* @return Agents
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email.
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set isActive.
*
* @param bool $isActive
*
* @return Agents
*/
public function setIsActive($isActive)
{
$this->isActive = $isActive;
return $this;
}
/**
* Get isActive.
*
* @return bool
*/
public function getIsActive()
{
return $this->isActive;
}
public function isIsActive(): ?bool
{
return $this->isActive;
}
public function getDateUpdated(): ?\DateTimeInterface
{
return $this->dateUpdated;
}
public function setDateUpdated(\DateTimeInterface $dateUpdated): self
{
$this->dateUpdated = $dateUpdated;
return $this;
}
public function getDateInserted(): ?\DateTimeInterface
{
return $this->dateInserted;
}
public function setDateInserted(\DateTimeInterface $dateInserted): self
{
$this->dateInserted = $dateInserted;
return $this;
}
}