Completed
Pull Request — master (#137)
by
unknown
11:25
created

Customer::setApiKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 6
rs 9.4285
1
<?php
2
3
namespace AppBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Symfony\Component\Security\Core\User\UserInterface;
7
use JMS\Serializer\Annotation\ExclusionPolicy;
8
use JMS\Serializer\Annotation\Expose;
9
use Symfony\Component\Validator\Constraints as Assert;
10
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
11
12
/**
13
 * User.
14
 *
15
 * @ORM\Table(name="customers")
16
 * @ORM\Entity(repositoryClass="AppBundle\Repository\CustomerRepository")
17
 * @UniqueEntity("facebookId")
18
 * @ExclusionPolicy("all")
19
 */
20
class Customer implements UserInterface
21
{
22
    /**
23
     * @var int
24
     *
25
     * @ORM\Column(name="id", type="integer")
26
     * @ORM\Id
27
     * @ORM\GeneratedValue(strategy="AUTO")
28
     */
29
    protected $id;
30
31
    /**
32
     * @var string
33
     *
34
     * @ORM\Column(name="first_name", type="string", length=100, nullable=true)
35
     * @Assert\Regex(pattern="/\d/", match=false)
36
     * @Assert\Type("string")
37
     * @Assert\Length(min=2, max=100)
38
     * @Expose
39
     */
40
    protected $firstName;
41
42
    /**
43
     * @var string
44
     *
45
     * @ORM\Column(name="last_name", type="string", length=100, nullable=true)
46
     * @Assert\Regex(pattern="/\d/", match=false)
47
     * @Assert\Type("string")
48
     * @Assert\Length(min=2, max=100)
49
     * @Expose
50
     */
51
    protected $lastName;
52
53
    /**
54
     * @var string
55
     *
56
     * @ORM\Column(name="email", type="string", length=100, nullable=true)
57
     * @Assert\Email()
58
     * @Assert\Type("string")
59
     * @Assert\Length(max=100)
60
     * @Expose
61
     */
62
    protected $email;
63
64
    /**
65
     * @var string
66
     *
67
     * @ORM\Column(name="username", type="string", length=100)
68
     * @Assert\Type("string")
69
     * @Assert\Length(max=100)
70
     */
71
    protected $username;
72
73
    /**
74
     * @var string
75
     *
76
     * @ORM\Column(name="api_key", type="string", length=255, nullable=true)
77
     * @Assert\Type("string")
78
     * @Assert\Length(max=255)
79
     * @Expose
80
     */
81
    private $apiKey;
82
83
    /**
84
     * @var string
85
     *
86
     * @ORM\Column(name="facebook_id", type="string", length=255, nullable=true, unique=true)
87
     * @Assert\Type("string")
88
     * @Assert\Length(max=255)
89
     */
90
    private $facebookId;
91
92
    /**
93
     * Get id.
94
     *
95
     * @return int
96
     */
97
    public function getId()
98
    {
99
        return $this->id;
100
    }
101
102
    /**
103
     * Set apiKey.
104
     *
105
     * @param string $apiKey
106
     *
107
     * @return Customer
108
     */
109
    public function setApiKey($apiKey)
110
    {
111
        $this->apiKey = $apiKey;
112
113
        return $this;
114
    }
115
116
    /**
117
     * Get apiKey.
118
     *
119
     * @return string
120
     */
121
    public function getApiKey()
122
    {
123
        return $this->apiKey;
124
    }
125
126
    /**
127
     * @inheritdoc
128
     */
129
    public function getRoles()
130
    {
131
        return array('ROLE_API');
132
    }
133
134
    /**
135
     * @inheritdoc
136
     */
137
    public function getPassword()
138
    {
139
    }
140
141
    /**
142
     * @inheritdoc
143
     */
144
    public function getSalt()
145
    {
146
    }
147
148
    /**
149
     * @inheritdoc
150
     */
151
    public function eraseCredentials()
152
    {
153
    }
154
155
    /**
156
     * Set facebookId.
157
     *
158
     * @param string $facebookId
159
     *
160
     * @return Customer
161
     */
162
    public function setFacebookId($facebookId)
163
    {
164
        $this->facebookId = $facebookId;
165
166
        return $this;
167
    }
168
169
    /**
170
     * Get facebookId.
171
     *
172
     * @return string
173
     */
174
    public function getFacebookId()
175
    {
176
        return $this->facebookId;
177
    }
178
179
    /**
180
     * Set username.
181
     *
182
     * @param string $username
183
     *
184
     * @return Customer
185
     */
186
    public function setUsername($username)
187
    {
188
        $this->username = $username;
189
190
        return $this;
191
    }
192
193
    /**
194
     * Get username.
195
     *
196
     * @return string
197
     */
198
    public function getUsername()
199
    {
200
        return $this->username;
201
    }
202
203
    /**
204
     * Set firstName.
205
     *
206
     * @param string $firstName
207
     *
208
     * @return Customer
209
     */
210
    public function setFirstName($firstName)
211
    {
212
        $this->firstName = $firstName;
213
214
        return $this;
215
    }
216
217
    /**
218
     * Get firstName.
219
     *
220
     * @return string
221
     */
222
    public function getFirstName()
223
    {
224
        return $this->firstName;
225
    }
226
227
    /**
228
     * Set lastName.
229
     *
230
     * @param string $lastName
231
     *
232
     * @return Customer
233
     */
234
    public function setLastName($lastName)
235
    {
236
        $this->lastName = $lastName;
237
238
        return $this;
239
    }
240
241
    /**
242
     * Get lastName.
243
     *
244
     * @return string
245
     */
246
    public function getLastName()
247
    {
248
        return $this->lastName;
249
    }
250
251
    /**
252
     * Set email.
253
     *
254
     * @param string $email
255
     *
256
     * @return Customer
257
     */
258
    public function setEmail($email)
259
    {
260
        $this->email = $email;
261
262
        return $this;
263
    }
264
265
    /**
266
     * Get email.
267
     *
268
     * @return string
269
     */
270
    public function getEmail()
271
    {
272
        return $this->email;
273
    }
274
}
275