1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\Entity; |
4
|
|
|
|
5
|
|
|
use AppBundle\Traits\TimestampableTrait; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Gedmo\Blameable\Traits\BlameableEntity; |
8
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
9
|
|
|
use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable; |
10
|
|
|
use Sonata\TranslationBundle\Model\TranslatableInterface; |
11
|
|
|
use AppBundle\Traits\DeletedByTrait; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Client. |
15
|
|
|
* |
16
|
|
|
* @ORM\Table() |
17
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\ClientRepository") |
18
|
|
|
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false) |
19
|
|
|
* @Gedmo\TranslationEntity(class="AppBundle\Entity\Translations\RoleTranslation") |
20
|
|
|
*/ |
21
|
|
|
class Client extends AbstractPersonalTranslatable implements TranslatableInterface |
22
|
|
|
{ |
23
|
|
|
use TimestampableTrait, BlameableEntity, DeletedByTrait; |
24
|
|
|
/** |
25
|
|
|
* @var int |
26
|
|
|
* |
27
|
|
|
* @ORM\Column(name="id", type="integer") |
28
|
|
|
* @ORM\Id |
29
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
30
|
|
|
*/ |
31
|
|
|
private $id; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
* |
36
|
|
|
* @ORM\Column(name="ip", type="string", length=20, unique=true) |
37
|
|
|
*/ |
38
|
|
|
private $ip; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var int |
42
|
|
|
* |
43
|
|
|
* @ORM\Column(name="countAttempts", type="integer") |
44
|
|
|
*/ |
45
|
|
|
private $countAttempts; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var bool |
49
|
|
|
* |
50
|
|
|
* @ORM\Column(name="banned", type="boolean") |
51
|
|
|
*/ |
52
|
|
|
private $banned; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Get id. |
56
|
|
|
* |
57
|
|
|
* @return int |
58
|
|
|
*/ |
59
|
|
|
public function getId() |
60
|
|
|
{ |
61
|
|
|
return $this->id; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Set ip. |
66
|
|
|
* |
67
|
|
|
* @param string $ip |
68
|
|
|
* |
69
|
|
|
* @return Client |
70
|
|
|
*/ |
71
|
|
|
public function setIp($ip) |
72
|
|
|
{ |
73
|
|
|
$this->ip = $ip; |
74
|
|
|
|
75
|
|
|
return $this; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Get ip. |
80
|
|
|
* |
81
|
|
|
* @return string |
82
|
|
|
*/ |
83
|
|
|
public function getIp() |
84
|
|
|
{ |
85
|
|
|
return $this->ip; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Set countAttempts. |
90
|
|
|
* |
91
|
|
|
* @param int $countAttempts |
92
|
|
|
* |
93
|
|
|
* @return Client |
94
|
|
|
*/ |
95
|
|
|
public function setCountAttempts($countAttempts) |
96
|
|
|
{ |
97
|
|
|
$this->countAttempts = $countAttempts; |
98
|
|
|
|
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Get countAttempts. |
104
|
|
|
* |
105
|
|
|
* @return int |
106
|
|
|
*/ |
107
|
|
|
public function getCountAttempts() |
108
|
|
|
{ |
109
|
|
|
return $this->countAttempts; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Set ban. |
114
|
|
|
* |
115
|
|
|
* @param bool $banned |
116
|
|
|
* |
117
|
|
|
* @return Client |
118
|
|
|
*/ |
119
|
|
|
public function setBanned($banned) |
120
|
|
|
{ |
121
|
|
|
$this->banned = $banned; |
122
|
|
|
|
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Get banned. |
128
|
|
|
* |
129
|
|
|
* @return bool |
130
|
|
|
*/ |
131
|
|
|
public function isBanned() |
132
|
|
|
{ |
133
|
|
|
return $this->banned; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
public function __toString() |
137
|
|
|
{ |
138
|
|
|
return $this->getIp(); |
139
|
|
|
} |
140
|
|
|
} |
141
|
|
|
|