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