Test Setup Failed
Push — master ( 14e042...222fdb )
by Artem
07:39 queued 05:58
created

Sponsor::getUpdatedAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Stfalcon\Bundle\SponsorBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Doctrine\Common\Collections\ArrayCollection;
7
use Symfony\Component\HttpFoundation\File\File;
8
use Symfony\Component\Validator\Constraints as Assert;
9
use Gedmo\Mapping\Annotation as Gedmo;
10
use Vich\UploaderBundle\Mapping\Annotation as Vich;
11
12
/**
13
 * Stfalcon\Bundle\SponsorBundle\Entity\Sponsor.
14
 *
15
 * @Vich\Uploadable
16
 *
17
 * @ORM\Table(name="sponsors")
18
 * @ORM\Entity(repositoryClass="Stfalcon\Bundle\SponsorBundle\Repository\SponsorRepository")
19
 */
20
class Sponsor
21
{
22
    /**
23
     * @var int
24
     *
25
     * @ORM\Column(type="integer")
26
     * @ORM\Id
27
     * @ORM\GeneratedValue(strategy="AUTO")
28
     */
29
    protected $id;
30
31
    /**
32
     * @var string
33
     *
34
     * @ORM\Column(name="name", type="string", length=255)
35
     */
36
    protected $name;
37
38
    /**
39
     * @var string
40
     *
41
     * @ORM\Column(name="site", type="string", nullable=true, length=255)
42
     *
43
     * @Assert\Url
44
     */
45
    protected $site;
46
47
    /**
48
     * @var string
49
     *
50
     * @ORM\Column(name="logo", type="string", nullable=true, length=255)
51
     */
52
    protected $logo;
53
54
    /**
55
     * @var int
56
     *
57
     * @ORM\Column(name="sort_order", type="integer", nullable=false)
58
     */
59
    protected $sortOrder = 1;
60
61
    /**
62
     * @var resource
63
     *
64
     * @Assert\File(maxSize="6000000")
65
     * @Assert\Image
66
     *
67
     * @Vich\UploadableField(mapping="sponsor_image", fileNameProperty="logo")
68
     */
69
    protected $file;
70
71
    /**
72
     * @ORM\OneToMany(targetEntity="Stfalcon\Bundle\SponsorBundle\Entity\EventSponsor",
73
     *     mappedBy="sponsor", cascade={"persist", "remove"}, orphanRemoval=true
74
     * )
75
     */
76
    protected $sponsorEvents;
77
78
    /**
79
     * @var \DateTime
80
     *
81
     * @ORM\Column(name="created_at", type="datetime")
82
     *
83
     * @Gedmo\Timestampable(on="create")
84
     */
85
    protected $createdAt;
86
87
    /**
88
     * @var \DateTime
89
     *
90
     * @ORM\Column(name="updated_at", type="datetime")
91
     *
92
     * @Gedmo\Timestampable(on="update")
93
     */
94
    protected $updatedAt;
95
96
    /**
97
     * Constructor.
98
     */
99
    public function __construct()
100
    {
101
        $this->sponsorEvents = new ArrayCollection();
102
    }
103
104
    /**
105
     * Get id.
106
     *
107
     * @return int
108
     */
109
    public function getId()
110
    {
111
        return $this->id;
112
    }
113
114
    /**
115
     * Set name.
116
     *
117
     * @param string $name
118
     *
119
     * @return $this
120
     */
121
    public function setName($name)
122
    {
123
        $this->name = $name;
124
125
        return $this;
126
    }
127
128
    /**
129
     * Get name.
130
     *
131
     * @return string
132
     */
133
    public function getName()
134
    {
135
        return $this->name;
136
    }
137
138
    /**
139
     * Get logo filename.
140
     *
141
     * @return string
142
     */
143
    public function getLogo()
144
    {
145
        return $this->logo;
146
    }
147
148
    /**
149
     * Set logo filename.
150
     *
151
     * @param string $logo
152
     *
153
     * @return $this
154
     */
155
    public function setLogo($logo)
156
    {
157
        $this->logo = $logo;
158
159
        return $this;
160
    }
161
162
    /**
163
     * Set sortOrder.
164
     *
165
     * @param int $sortOrder
166
     *
167
     * @return $this
168
     */
169
    public function setSortOrder($sortOrder)
170
    {
171
        $this->sortOrder = $sortOrder;
172
173
        return $this;
174
    }
175
176
    /**
177
     * Get sortOrder.
178
     *
179
     * @return int
180
     */
181
    public function getSortOrder()
182
    {
183
        return $this->sortOrder;
184
    }
185
186
    /**
187
     * Set site.
188
     *
189
     * @param string $site
190
     *
191
     * @return $this
192
     */
193
    public function setSite($site)
194
    {
195
        $this->site = $site;
196
197
        return $this;
198
    }
199
200
    /**
201
     * Get site.
202
     *
203
     * @return string
204
     */
205
    public function getSite()
206
    {
207
        return $this->site;
208
    }
209
210
    /**
211
     * @return resource
212
     */
213
    public function getFile()
214
    {
215
        return $this->file;
216
    }
217
218
    /**
219
     * @param File $file
220
     *
221
     * @return $this
222
     */
223
    public function setFile($file)
224
    {
225
        $this->file = $file;
0 ignored issues
show
Documentation Bug introduced by
It seems like $file of type Symfony\Component\HttpFoundation\File\File is incompatible with the declared type resource of property $file.

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...
226
227
        return $this;
228
    }
229
230
    /**
231
     * @param EventSponsor $sponsorEvent
232
     *
233
     * @return $this
234
     */
235
    public function addSponsorEvents(EventSponsor $sponsorEvent)
236
    {
237
        $this->sponsorEvents[] = $sponsorEvent;
238
239
        return $this;
240
    }
241
242
    /**
243
     * @param ArrayCollection $sponsorEvents
244
     *
245
     * @return $this
246
     */
247
    public function setSponsorEvents($sponsorEvents)
248
    {
249
        foreach ($sponsorEvents as $sponsorEvent) {
250
            $sponsorEvent->setSponsor($this);
251
        }
252
        $this->sponsorEvents = $sponsorEvents;
253
254
        return $this;
255
    }
256
257
    /**
258
     * @return ArrayCollection
259
     */
260
    public function getSponsorEvents()
261
    {
262
        return $this->sponsorEvents;
263
    }
264
265
    /**
266
     * Get createdAt.
267
     *
268
     * @return \Datetime createdAt
269
     */
270
    public function getCreatedAt()
271
    {
272
        return $this->createdAt;
273
    }
274
275
    /**
276
     * Set createdAt.
277
     *
278
     * @param \Datetime $createdAt createdAt
279
     *
280
     * @return $this
281
     */
282
    public function setCreatedAt($createdAt)
283
    {
284
        $this->createdAt = $createdAt;
285
286
        return $this;
287
    }
288
289
    /**
290
     * Get updatedAt.
291
     *
292
     * @return \Datetime updatedAt
293
     */
294
    public function getUpdatedAt()
295
    {
296
        return $this->updatedAt;
297
    }
298
299
    /**
300
     * Set updatedAt.
301
     *
302
     * @param \Datetime $updatedAt updatedAt
303
     *
304
     * @return $this
305
     */
306
    public function setUpdatedAt($updatedAt)
307
    {
308
        $this->updatedAt = $updatedAt;
309
310
        return $this;
311
    }
312
313
    /**
314
     * Get sponsor name if object treated like a string.
315
     *
316
     * @return string
317
     */
318
    public function __toString()
319
    {
320
        return (string) $this->getName() ?: '-';
321
    }
322
}
323