Browse Source

Ajout de l'entité RegistrationToken

bastien 12 years ago
parent
commit
a111dd21f6
1 changed files with 100 additions and 0 deletions
  1. 100 0
      src/Muzich/CoreBundle/Entity/RegistrationToken.php

+ 100 - 0
src/Muzich/CoreBundle/Entity/RegistrationToken.php View File

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