src/Entity/ConfirmationSMS.php line 17

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\ConfirmationSMSRepository")
  11.  * @ApiResource()
  12.  */
  13. class ConfirmationSMS
  14. {
  15.     /**
  16.      * @var integer $id
  17.      *
  18.      * @ORM\Id
  19.      * @ORM\Column(type="integer")
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @var text
  25.      *
  26.      * @ORM\Column(type="integer")
  27.      * @Assert\NotBlank()
  28.      */
  29.     private $code;
  30.     /**
  31.      * @var \DateTime
  32.      *
  33.      * @ORM\Column(type="datetime")
  34.      */
  35.     private $dateExpiration;
  36.     /**
  37.      * @var text
  38.      *
  39.      * @ORM\Column(name="phone", type="string", length=20)
  40.      * @Assert\NotBlank()
  41.      */
  42.     private $phone;
  43.     /**
  44.      * @var bool
  45.      *
  46.      * @ORM\Column(type="boolean")
  47.      */
  48.     private $actif;
  49.     /**
  50.      * Constructor of ConfirmationSMS Entity
  51.      */
  52.     public function __construct()
  53.     {
  54.         $this->code mt_rand(100000999999);
  55.         $this->dateExpiration = new \DateTime();
  56.         $this->actif true;
  57.     }
  58.     public function __toString()
  59.     {
  60.         return ($this->getCode()) ? $this->getCode() : 'Unknown';
  61.     }
  62.     /**
  63.      * Get id
  64.      *
  65.      * @return integer
  66.      */
  67.     public function getId()
  68.     {
  69.         return $this->id;
  70.     }
  71.     /**
  72.      * Get code
  73.      *
  74.      * @return string
  75.      */
  76.     public function getCode()
  77.     {
  78.         return $this->code;
  79.     }
  80.     /**
  81.      * Set code
  82.      *
  83.      * @param string code
  84.      *
  85.      * @return ConfirmationSMS
  86.      */
  87.     public function setCode($code)
  88.     {
  89.         $this->code $code;
  90.         return $this;
  91.     }
  92.     /**
  93.      * Set dateExpiration
  94.      *
  95.      * @param \DateTime $dateExpiration
  96.      * @return ConfirmationSMS
  97.      */
  98.     public function setDateExpiration($dateExpiration)
  99.     {
  100.         $this->dateExpiration $dateExpiration;
  101.         return $this;
  102.     }
  103.     /**
  104.      * Get dateExpiration
  105.      *
  106.      * @return \DateTime
  107.      */
  108.     public function getDateExpiration()
  109.     {
  110.         return $this->dateExpiration;
  111.     }
  112.     /**
  113.      * Get phone
  114.      *
  115.      * @return string
  116.      */
  117.     public function getPhone()
  118.     {
  119.         return $this->phone;
  120.     }
  121.     /**
  122.      * Set phone
  123.      *
  124.      * @param string $phone
  125.      *
  126.      * @return ConfirmationSMS
  127.      */
  128.     public function setPhone($phone)
  129.     {
  130.         $this->phone $phone;
  131.         return $this;
  132.     }
  133.     /**
  134.      * Get actif
  135.      *
  136.      * @return boolean
  137.      */
  138.     public function getActif()
  139.     {
  140.         return $this->actif;
  141.     }
  142.     /**
  143.      * Set actif
  144.      *
  145.      * @param bool $actif
  146.      *
  147.      * @return ConfirmationSMS
  148.      */
  149.     public function setActif($actif)
  150.     {
  151.         $this->actif $actif;
  152.         return $this;
  153.     }
  154. }