RegistrationToken.php 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. namespace Muzich\CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. /**
  7. * Le RegistrationToken sert uniquement a contrôler les inscription durant
  8. * toute la phase fermé du site en production.
  9. *
  10. * @ORM\Entity
  11. * @UniqueEntity(fields="token")
  12. */
  13. class RegistrationToken
  14. {
  15. /**
  16. * @ORM\Id
  17. * @ORM\Column(type="integer")
  18. * @ORM\GeneratedValue(strategy="AUTO")
  19. * @var type int
  20. */
  21. protected $id;
  22. /**
  23. * Le token en question
  24. *
  25. * @ORM\Column(type="string", length=32, unique=true)
  26. * @Assert\NotBlank()
  27. * @Assert\MinLength(limit=3)
  28. * @Assert\MaxLength(32)
  29. * @var type string
  30. */
  31. protected $token;
  32. /**
  33. * Si ce boolean est a vrai il n'est plus utilisable
  34. * @ORM\Column(type="boolean", nullable=true)
  35. * @var type boolean
  36. */
  37. protected $used = false;
  38. public function __toString()
  39. {
  40. return $this->getToken();
  41. }
  42. /**
  43. * Get id
  44. *
  45. * @return integer
  46. */
  47. public function getId()
  48. {
  49. return $this->id;
  50. }
  51. /**
  52. * Set token
  53. *
  54. * @param string $token
  55. */
  56. public function setToken($token)
  57. {
  58. $this->token = $token;
  59. }
  60. /**
  61. * Get token
  62. *
  63. * @return string
  64. */
  65. public function getToken()
  66. {
  67. return $this->token;
  68. }
  69. /**
  70. * Set used
  71. *
  72. * @param boolean $used
  73. */
  74. public function setUsed($used)
  75. {
  76. $this->used = $used;
  77. }
  78. /**
  79. * Get used
  80. *
  81. * @return boolean
  82. */
  83. public function getUsed()
  84. {
  85. return $this->used;
  86. }
  87. }