Completed
Push — master ( 23bc34...6717d0 )
by Zlatin
02:26
created

Media::getActive()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Media\Entity;
4
5
/**
6
 * 
7
 * @Entity
8
 * @HasLifecycleCallbacks
9
 * @Table(name="media_attachments")
10
 */
11
class Media
12
{
13
    
14
    /**
15
     *
16
     * @var string
17
     * 
18
     * @Column(type="string")
19
     */
20
    protected $name;
21
    
22
    /**
23
     *
24
     * @var \Symfony\Component\HttpFoundation\File\UploadedFile
25
     */
26
    protected $binary;
27
    
28
    /**
29
     *
30
     * @var string
31
     * 
32
     * @Column(type="string")
33
     */
34
    protected $reference;
35
    
36
    /**
37
     *
38
     * @var array
39
     * 
40
     * @Column(type="array")
41
     */
42
    protected $meta;
43
    
44
    /**
45
     *
46
     * @var boolean
47
     * 
48
     * @Column(name="is_active", type="boolean", nullable=true)
49
     */
50
    protected $active = true;
51
    
52
    /**
53
     *
54
     * @var DateTime
55
     * 
56
     * @Column(name="updated_at", type="datetime", nullable=true)
57
     */
58
    protected $updatedAt;
59
    
60
    /**
61
     *
62
     * @var DateTime
63
     * 
64
     * @Column(name="created_at", type="datetime", nullable=true)
65
     */
66
    protected $createdAt;
67
68
    /**
69
     * 
70
     * @return string
71
     */
72
    public function __toString()
73
    {
74
        return $this->getName() ? : "";
75
    }
76
    
77
    /**
78
     * 
79
     * @return \Symfony\Component\HttpFoundation\File\UploadedFile
80
     */
81
    public function getBinary()
82
    {
83
        return $this->binary;
84
    }
85
    
86
    /**
87
     * 
88
     * @param \Symfony\Component\HttpFoundation\File\UploadedFile $binary
89
     * 
90
     * @return \Media\Entity\Media
91
     */
92
    public function setBinary($binary)
93
    {
94
        $this->binary = $binary;
95
        
96
        return $this;
97
    }
98
    
99
    /**
100
     * 
101
     * @PreUpdate
102
     */
103
    public function preUpdate()
104
    {
105
        $this->updatedAt = new \DateTime();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \DateTime() of type object<DateTime> is incompatible with the declared type object<Media\Entity\DateTime> of property $updatedAt.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
106
    }
107
    
108
    /**
109
     * 
110
     * @PrePersist
111
     */
112
    public function prePersist()
113
    {
114
        $this->createdAt = new \DateTime();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \DateTime() of type object<DateTime> is incompatible with the declared type object<Media\Entity\DateTime> of property $createdAt.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
115
        $this->updatedAt = new \DateTime();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \DateTime() of type object<DateTime> is incompatible with the declared type object<Media\Entity\DateTime> of property $updatedAt.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
116
    }
117
118
    /**
119
     * Get id
120
     *
121
     * @return integer
122
     */
123
    public function getId()
124
    {
125
        return $this->id;
0 ignored issues
show
Bug introduced by
The property id does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
126
    }
127
128
    /**
129
     * Set name
130
     *
131
     * @param string $name
132
     *
133
     * @return Media
134
     */
135
    public function setName($name)
136
    {
137
        $this->name = $name;
138
139
        return $this;
140
    }
141
142
    /**
143
     * Get name
144
     *
145
     * @return string
146
     */
147
    public function getName()
148
    {
149
        return $this->name;
150
    }
151
152
    /**
153
     * Set reference
154
     *
155
     * @param string $reference
156
     *
157
     * @return Media
158
     */
159
    public function setReference($reference)
160
    {
161
        $this->reference = $reference;
162
163
        return $this;
164
    }
165
166
    /**
167
     * Get reference
168
     *
169
     * @return string
170
     */
171
    public function getReference()
172
    {
173
        return $this->reference;
174
    }
175
176
    /**
177
     * Set meta
178
     *
179
     * @param array $meta
180
     *
181
     * @return Media
182
     */
183
    public function setMeta($meta)
184
    {
185
        $this->meta = $meta;
186
187
        return $this;
188
    }
189
190
    /**
191
     * Get meta
192
     *
193
     * @return array
194
     */
195
    public function getMeta()
196
    {
197
        return $this->meta;
198
    }
199
200
    /**
201
     * Set active
202
     *
203
     * @param boolean $active
204
     *
205
     * @return Media
206
     */
207
    public function setActive($active)
208
    {
209
        $this->active = $active;
210
211
        return $this;
212
    }
213
214
    /**
215
     * Get active
216
     *
217
     * @return boolean
218
     */
219
    public function getActive()
220
    {
221
        return $this->active;
222
    }
223
224
    /**
225
     * Set updatedAt
226
     *
227
     * @param \DateTime $updatedAt
228
     *
229
     * @return Media
230
     */
231
    public function setUpdatedAt($updatedAt)
232
    {
233
        $this->updatedAt = $updatedAt;
0 ignored issues
show
Documentation Bug introduced by
It seems like $updatedAt of type object<DateTime> is incompatible with the declared type object<Media\Entity\DateTime> of property $updatedAt.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
234
235
        return $this;
236
    }
237
238
    /**
239
     * Get updatedAt
240
     *
241
     * @return \DateTime
242
     */
243
    public function getUpdatedAt()
244
    {
245
        return $this->updatedAt;
246
    }
247
248
    /**
249
     * Set createdAt
250
     *
251
     * @param \DateTime $createdAt
252
     *
253
     * @return Media
254
     */
255
    public function setCreatedAt($createdAt)
256
    {
257
        $this->createdAt = $createdAt;
0 ignored issues
show
Documentation Bug introduced by
It seems like $createdAt of type object<DateTime> is incompatible with the declared type object<Media\Entity\DateTime> of property $createdAt.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
258
259
        return $this;
260
    }
261
262
    /**
263
     * Get createdAt
264
     *
265
     * @return \DateTime
266
     */
267
    public function getCreatedAt()
268
    {
269
        return $this->createdAt;
270
    }
271
}
272