src/Entity/ConfirmationEmail.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. /**
  7.  * @author <erwan> <erwan@kodiom.com>
  8.  *
  9.  * @ORM\Table()
  10.  * @ORM\Entity(repositoryClass="App\Entity\ConfirmationEmailRepository")
  11.  * @ApiResource(
  12.  *     collectionOperations={
  13.  *        "get"={"method"="GET"}
  14.  *     },
  15.  *     itemOperations={
  16.  *        "get"={"method"="GET"}
  17.  *     }
  18.  * )
  19.  */
  20. class ConfirmationEmail
  21. {
  22.     /**
  23.      * @var integer $id
  24.      *
  25.      * @ORM\Id
  26.      * @ORM\Column(type="integer")
  27.      * @ORM\GeneratedValue(strategy="AUTO")
  28.      */
  29.     private $id;
  30.     /**
  31.      * @var text
  32.      *
  33.      * @ORM\Column(type="integer")
  34.      * @Assert\NotBlank()
  35.      */
  36.     private $code;
  37.     /**
  38.      * @var \DateTime
  39.      *
  40.      * @ORM\Column(type="datetime")
  41.      */
  42.     private $dateExpiration;
  43.     /**
  44.      * @var text
  45.      *
  46.      * @ORM\Column(name="email", type="string", length=20)
  47.      * @Assert\NotBlank()
  48.      */
  49.     private $email;
  50.     /**
  51.      * @var bool
  52.      *
  53.      * @ORM\Column(type="boolean")
  54.      */
  55.     private $actif;
  56.     /**
  57.      * Constructor of ConfirmationEmail Entity
  58.      */
  59.     public function __construct()
  60.     {
  61.         $this->code mt_rand(100000999999);
  62.         $this->dateExpiration = new \DateTime();
  63.         $this->actif true;
  64.     }
  65.     public function __toString()
  66.     {
  67.         return ($this->getCode()) ? $this->getCode() : 'Unknown';
  68.     }
  69.     /**
  70.      * Get id
  71.      *
  72.      * @return integer
  73.      */
  74.     public function getId()
  75.     {
  76.         return $this->id;
  77.     }
  78.     /**
  79.      * Get code
  80.      *
  81.      * @return string
  82.      */
  83.     public function getCode()
  84.     {
  85.         return $this->code;
  86.     }
  87.     /**
  88.      * Set code
  89.      *
  90.      * @param string code
  91.      *
  92.      * @return ConfirmationEmail
  93.      */
  94.     public function setCode($code)
  95.     {
  96.         $this->code $code;
  97.         return $this;
  98.     }
  99.     /**
  100.      * Set dateExpiration
  101.      *
  102.      * @param \DateTime $dateExpiration
  103.      * @return ConfirmationEmail
  104.      */
  105.     public function setDateExpiration($dateExpiration)
  106.     {
  107.         $this->dateExpiration $dateExpiration;
  108.         return $this;
  109.     }
  110.     /**
  111.      * Get dateExpiration
  112.      *
  113.      * @return \DateTime
  114.      */
  115.     public function getDateExpiration()
  116.     {
  117.         return $this->dateExpiration;
  118.     }
  119.     /**
  120.      * Get email
  121.      *
  122.      * @return string
  123.      */
  124.     public function getEmail()
  125.     {
  126.         return $this->email;
  127.     }
  128.     /**
  129.      * Set email
  130.      *
  131.      * @param string $email
  132.      *
  133.      * @return ConfirmationEmail
  134.      */
  135.     public function setEmail($email)
  136.     {
  137.         $this->email $email;
  138.         return $this;
  139.     }
  140.     /**
  141.      * Get actif
  142.      *
  143.      * @return boolean
  144.      */
  145.     public function getActif()
  146.     {
  147.         return $this->actif;
  148.     }
  149.     /**
  150.      * Set actif
  151.      *
  152.      * @param bool $actif
  153.      *
  154.      * @return ConfirmationEmail
  155.      */
  156.     public function setActif($actif)
  157.     {
  158.         $this->actif $actif;
  159.         return $this;
  160.     }
  161. }