<?phpnamespace App\Entity;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;use ApiPlatform\Core\Annotation\ApiResource;/** * @author <erwan> <erwan@kodiom.com> * * @ORM\Table() * @ORM\Entity(repositoryClass="App\Repository\PasswordResetRepository") * @ApiResource( * collectionOperations={ * "get"={"method"="GET"}, * "demand"={"route_name"="api_password_reset_demand"} * }, * itemOperations={ * "get"={"method"="GET"}, * "reset"={"route_name"="api_password_reset_reset"} * } * ) */class PasswordReset{ /** * @var integer $id * * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var integer * * @ORM\Column(type="integer") * @Assert\NotBlank() */ private $code; /** * @var \DateTime * * @ORM\Column(type="datetime") */ private $dateExpiration; /** * @var string * * @ORM\Column(type="string", length=255) * @Assert\NotBlank() */ private $email; /** * @var bool * * @ORM\Column(type="boolean") */ private $actif; /** * Constructor of PasswordReset Entity */ public function __construct() { $this->code = mt_rand(100000, 999999); $this->dateExpiration = new \DateTime(); $this->actif = true; } public function __toString() { return ($this->getCode()) ? $this->getCode() : 'Unknown'; } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Get code * * @return string */ public function getCode() { return $this->code; } /** * Set code * * @param string code * * @return PasswordReset */ public function setCode($code) { $this->code = $code; return $this; } /** * Set dateExpiration * * @param \DateTime $dateExpiration * @return PasswordReset */ public function setDateExpiration($dateExpiration) { $this->dateExpiration = $dateExpiration; return $this; } /** * Get dateExpiration * * @return \DateTime */ public function getDateExpiration() { return $this->dateExpiration; } /** * Get email * * @return string */ public function getEmail() { return $this->email; } /** * Set email * * @param string email * * @return PasswordReset */ public function setEmail($email) { $this->email = $email; return $this; } /** * Get actif * * @return boolean */ public function getActif() { return $this->actif; } /** * Set actif * * @param bool $actif * * @return PasswordReset */ public function setActif($actif) { $this->actif = $actif; return $this; }}