Passed
Push — master ( ec2ac4...5107be )
by Julito
09:28 queued 10s
created

ResourceFile::setId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CoreBundle\Entity\Resource;
5
6
use Doctrine\ORM\Mapping as ORM;
7
use Gedmo\Mapping\Annotation as Gedmo;
8
9
/**
10
 * @ORM\Entity
11
 *
12
 * @ORM\Table(name="resource_file")
13
 */
14
class ResourceFile
15
{
16
    /**
17
     * @ORM\Id
18
     * @ORM\Column(type="integer")
19
     * @ORM\GeneratedValue
20
     */
21
    protected $id;
22
23
    /**
24
     * @ORM\OneToOne(targetEntity="Chamilo\MediaBundle\Entity\Media", cascade={"all"})
25
     */
26
    protected $media;
27
28
//    /**
29
//     * @var string
30
//     *
31
//     * @Assert\NotBlank()
32
//     *
33
//     * @ORM\Column(name="hash", type="string", nullable=false)
34
//     */
35
//    protected $hash;
36
37
//    /**
38
//     * @Assert\NotBlank()
39
//     *
40
//     * @var string
41
//     *
42
//     * @ORM\Column(name="original_filename", type="string", nullable=false)
43
//     */
44
//    protected $originalFilename;
45
//
46
//    /**
47
//     * @Assert\NotBlank()
48
//     *
49
//     * @var string
50
//     *
51
//     * @ORM\Column(name="size", type="string", nullable=false)
52
//     */
53
//    protected $size;
54
//
55
//    /**
56
//     * @Assert\NotBlank()
57
//     *
58
//     * @var string
59
//     *
60
//     * @ORM\Column(name="width", type="string", nullable=true)
61
//     */
62
//    protected $width;
63
64
//    /**
65
//     * @Assert\NotBlank()
66
//     *
67
//     * @var string
68
//     *
69
//     * @ORM\Column(name="height", type="string", nullable=true)
70
//     */
71
//    protected $height;
72
//
73
//    /**
74
//     * @var string
75
//     *
76
//     * @ORM\Column(name="copyright", type="string", nullable=true)
77
//     */
78
//    protected $copyright;
79
80
//    /**
81
//     * @var string
82
//     *
83
//     * @ORM\Column(name="contentType", type="string", nullable=true)
84
//     */
85
//    protected $contentType;
86
//
87
//    /**
88
//     * @var string
89
//     *
90
//     * @ORM\Column(name="extension", type="string", nullable=false)
91
//     */
92
//    protected $extension;
93
94
    /**
95
     * @var ResourceNode
96
     *
97
     * @ORM\OneToOne(targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceNode", mappedBy="resourceFile")
98
     */
99
    protected $resourceNode;
100
101
    /**
102
     * @var bool
103
     *
104
     * @ORM\Column(name="enabled", type="boolean")
105
     */
106
    protected $enabled;
107
108
    /**
109
     * @ORM\Column(name="created_at", type="datetime")
110
     *
111
     * @Gedmo\Timestampable(on="create")
112
     */
113
    protected $createdAt;
114
115
    /**
116
     * @ORM\Column(name="updated_at", type="datetime")
117
     *
118
     * @Gedmo\Timestampable(on="update")
119
     */
120
    protected $updatedAt;
121
122
    /**
123
     * Constructor.
124
     */
125
    public function __construct()
126
    {
127
        $this->enabled = true;
128
        $this->setOriginalFilename(uniqid());
129
    }
130
131
    /**
132
     * @return mixed
133
     */
134
    public function getName()
135
    {
136
        return $this->name;
137
    }
138
139
    /**
140
     * @param mixed $name
141
     *
142
     * @return ResourceFile
143
     */
144
    public function setName($name)
145
    {
146
        $this->name = $name;
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
147
148
        return $this;
149
    }
150
151
    /**
152
     * @return string
153
     */
154
    public function getHash(): string
155
    {
156
        return $this->hash;
157
    }
158
159
    /**
160
     * @param string $hash
161
     *
162
     * @return ResourceFile
163
     */
164
    public function setHash(string $hash): ResourceFile
165
    {
166
        $this->hash = $hash;
0 ignored issues
show
Bug Best Practice introduced by
The property hash does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
167
168
        return $this;
169
    }
170
171
    /**
172
     * @return string
173
     */
174
    public function getOriginalFilename(): string
175
    {
176
        return $this->originalFilename;
177
    }
178
179
    /**
180
     * @param string $originalFilename
181
     *
182
     * @return ResourceFile
183
     */
184
    public function setOriginalFilename(string $originalFilename): ResourceFile
185
    {
186
        $this->originalFilename = $originalFilename;
0 ignored issues
show
Bug Best Practice introduced by
The property originalFilename does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
187
188
        return $this;
189
    }
190
191
    /**
192
     * @return string
193
     */
194
    public function getSize(): string
195
    {
196
        return $this->size;
197
    }
198
199
    /**
200
     * @param string $size
201
     *
202
     * @return ResourceFile
203
     */
204
    public function setSize(string $size): ResourceFile
205
    {
206
        $this->size = $size;
0 ignored issues
show
Bug Best Practice introduced by
The property size does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
207
208
        return $this;
209
    }
210
211
    /**
212
     * @return string
213
     */
214
    public function getWidth(): string
215
    {
216
        return $this->width;
217
    }
218
219
    /**
220
     * @param string $width
221
     *
222
     * @return ResourceFile
223
     */
224
    public function setWidth(string $width): ResourceFile
225
    {
226
        $this->width = $width;
0 ignored issues
show
Bug Best Practice introduced by
The property width does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
227
228
        return $this;
229
    }
230
231
    /**
232
     * @return string
233
     */
234
    public function getHeight(): string
235
    {
236
        return $this->height;
237
    }
238
239
    /**
240
     * @param string $height
241
     *
242
     * @return ResourceFile
243
     */
244
    public function setHeight(string $height): ResourceFile
245
    {
246
        $this->height = $height;
0 ignored issues
show
Bug Best Practice introduced by
The property height does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
247
248
        return $this;
249
    }
250
251
    /**
252
     * @return string
253
     */
254
    public function getCopyright(): string
255
    {
256
        return (string) $this->copyright;
0 ignored issues
show
Bug Best Practice introduced by
The property copyright does not exist on Chamilo\CoreBundle\Entity\Resource\ResourceFile. Did you maybe forget to declare it?
Loading history...
257
    }
258
259
    /**
260
     * @return string
261
     */
262
    public function getContentType(): string
263
    {
264
        return (string) $this->contentType;
265
    }
266
267
    /**
268
     * @param string $contentType
269
     *
270
     * @return ResourceFile
271
     */
272
    public function setContentType(string $contentType): ResourceFile
273
    {
274
        $this->contentType = $contentType;
0 ignored issues
show
Bug Best Practice introduced by
The property contentType does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
275
276
        return $this;
277
    }
278
279
    /**
280
     * @return string
281
     */
282
    public function getExtension(): string
283
    {
284
        return $this->extension;
285
    }
286
287
    /**
288
     * @param string $extension
289
     *
290
     * @return ResourceFile
291
     */
292
    public function setExtension(string $extension): ResourceFile
293
    {
294
        $this->extension = $extension;
0 ignored issues
show
Bug Best Practice introduced by
The property extension does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
295
296
        return $this;
297
    }
298
299
    /**
300
     * @return ResourceNode
301
     */
302
    public function getResourceNode(): ResourceNode
303
    {
304
        return $this->resourceNode;
305
    }
306
307
    /**
308
     * @param ResourceNode $resourceNode
309
     *
310
     * @return ResourceFile
311
     */
312
    public function setResourceNode(ResourceNode $resourceNode): ResourceFile
313
    {
314
        $this->resourceNode = $resourceNode;
315
316
        return $this;
317
    }
318
319
    /**
320
     * @return bool
321
     */
322
    public function isEnabled(): bool
323
    {
324
        return $this->enabled;
325
    }
326
327
    /**
328
     * @param bool $enabled
329
     *
330
     * @return ResourceFile
331
     */
332
    public function setEnabled(bool $enabled): ResourceFile
333
    {
334
        $this->enabled = $enabled;
335
336
        return $this;
337
    }
338
339
    /**
340
     * @return mixed
341
     */
342
    public function getMedia()
343
    {
344
        return $this->media;
345
    }
346
347
    /**
348
     * @param mixed $media
349
     *
350
     * @return ResourceFile
351
     */
352
    public function setMedia($media)
353
    {
354
        $this->media = $media;
355
356
        return $this;
357
    }
358
359
    /**
360
     * @return mixed
361
     */
362
    public function getId()
363
    {
364
        return $this->id;
365
    }
366
367
    /**
368
     * @param mixed $id
369
     *
370
     * @return ResourceFile
371
     */
372
    public function setId($id)
373
    {
374
        $this->id = $id;
375
376
        return $this;
377
    }
378
379
380
381
382
}
383