Completed
Push — master ( 08d451...0978b6 )
by Valery
04:41 queued 10s
created

Property::getPriorityNumber()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Entity;
6
7
use App\Entity\Traits\EntityIdTrait;
8
use App\Entity\Traits\EntityMetaTrait;
9
use App\Entity\Traits\EntityTimestampableTrait;
10
use Doctrine\Common\Collections\ArrayCollection;
11
use Doctrine\Common\Collections\Collection;
12
use Doctrine\ORM\Mapping as ORM;
13
14
/**
15
 * @ORM\Entity(repositoryClass="App\Repository\PropertyRepository")
16
 */
17
class Property
18
{
19
    use EntityIdTrait;
20
    use EntityMetaTrait;
21
    use EntityTimestampableTrait;
22
23
    /**
24
     * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="properties")
25
     * @ORM\JoinColumn(nullable=false)
26
     */
27
    private $author;
28
29
    /**
30
     * @ORM\ManyToOne(targetEntity="App\Entity\DealType", inversedBy="properties")
31
     * @ORM\JoinColumn(nullable=false)
32
     */
33
    private $deal_type;
34
35
    /**
36
     * @ORM\ManyToOne(targetEntity="App\Entity\Category", inversedBy="properties")
37
     * @ORM\JoinColumn(nullable=false)
38
     */
39
    private $category;
40
41
    /**
42
     * @ORM\ManyToOne(targetEntity="App\Entity\City", inversedBy="properties")
43
     * @ORM\JoinColumn(nullable=false)
44
     */
45
    private $city;
46
47
    /**
48
     * @ORM\ManyToOne(targetEntity="App\Entity\Neighborhood", inversedBy="properties")
49
     * @ORM\JoinColumn(nullable=true)
50
     */
51
    private $neighborhood;
52
53
    /**
54
     * @ORM\Column(type="string", length=255)
55
     */
56
    private $title;
57
58
    /**
59
     * @ORM\Column(type="string", length=255, nullable=true)
60
     */
61
    private $slug;
62
63
    /**
64
     * @ORM\Column(type="text")
65
     */
66
    private $content;
67
68
    /**
69
     * @ORM\Column(type="smallint", nullable=true)
70
     */
71
    private $bathrooms_number;
72
73
    /**
74
     * @ORM\Column(type="smallint", nullable=true)
75
     */
76
    private $bedrooms_number;
77
78
    /**
79
     * @ORM\Column(type="smallint", nullable=true)
80
     */
81
    private $max_guests;
82
83
    /**
84
     * @ORM\Column(type="string", length=255)
85
     */
86
    private $address;
87
88
    /**
89
     * @ORM\Column(type="string", length=255, nullable=true)
90
     */
91
    private $latitude;
92
93
    /**
94
     * @ORM\Column(type="string", length=255, nullable=true)
95
     */
96
    private $longitude;
97
98
    /**
99
     * @ORM\Column(type="boolean", nullable=true)
100
     */
101
    private $show_map;
102
103
    /**
104
     * @ORM\Column(type="integer", nullable=true)
105
     */
106
    private $price;
107
108
    /**
109
     * @ORM\Column(type="string", length=255, nullable=true)
110
     */
111
    private $price_type;
112
113
    /**
114
     * @ORM\Column(type="boolean", nullable=true)
115
     */
116
    private $available_now;
117
118
    /**
119
     * @ORM\Column(type="string", length=255, options={"default": "pending"})
120
     */
121
    private $state = 'published';
122
123
    /**
124
     * @ORM\OneToMany(targetEntity="App\Entity\Photo", mappedBy="property", orphanRemoval=true)
125
     * @ORM\OrderBy({"sort_order" = "ASC"})
126
     */
127
    private $photos;
128
129
    /**
130
     * @ORM\ManyToMany(targetEntity="App\Entity\Feature", inversedBy="properties")
131
     */
132
    private $features;
133
134
    /**
135
     * @ORM\ManyToOne(targetEntity="App\Entity\Metro", inversedBy="properties")
136
     * @ORM\JoinColumn(nullable=true)
137
     */
138
    private $metro_station;
139
140
    /**
141
     * @ORM\Column(type="integer")
142
     */
143
    private $priority_number;
144
145
    /**
146
     * @ORM\ManyToOne(targetEntity="App\Entity\District", inversedBy="properties")
147
     * @ORM\JoinColumn(nullable=true)
148
     */
149
    private $district;
150
151
    public function __construct()
152
    {
153
        $this->photos = new ArrayCollection();
154
        $this->features = new ArrayCollection();
155
    }
156
157
    public function getAuthor(): ?User
158
    {
159
        return $this->author;
160
    }
161
162
    public function setAuthor(?User $author): self
163
    {
164
        $this->author = $author;
165
166
        return $this;
167
    }
168
169
    public function getDealType(): ?DealType
170
    {
171
        return $this->deal_type;
172
    }
173
174
    public function setDealType(?DealType $dealType): self
175
    {
176
        $this->deal_type = $dealType;
177
178
        return $this;
179
    }
180
181
    public function getCategory(): ?Category
182
    {
183
        return $this->category;
184
    }
185
186
    public function setCategory(?Category $category): self
187
    {
188
        $this->category = $category;
189
190
        return $this;
191
    }
192
193
    public function getCity(): ?City
194
    {
195
        return $this->city;
196
    }
197
198
    public function setCity(?City $city): self
199
    {
200
        $this->city = $city;
201
202
        return $this;
203
    }
204
205
    public function getTitle(): ?string
206
    {
207
        return $this->title;
208
    }
209
210
    public function setTitle(string $title): self
211
    {
212
        $this->title = $title;
213
214
        return $this;
215
    }
216
217
    public function getSlug(): ?string
218
    {
219
        return $this->slug;
220
    }
221
222
    public function setSlug(string $slug): self
223
    {
224
        $this->slug = $slug;
225
226
        return $this;
227
    }
228
229
    public function getContent(): ?string
230
    {
231
        return $this->content;
232
    }
233
234
    public function setContent(string $content): self
235
    {
236
        $this->content = $content;
237
238
        return $this;
239
    }
240
241
    public function getBathroomsNumber(): ?int
242
    {
243
        return $this->bathrooms_number;
244
    }
245
246
    public function setBathroomsNumber(?int $bathrooms_number): self
247
    {
248
        $this->bathrooms_number = $bathrooms_number;
249
250
        return $this;
251
    }
252
253
    public function getBedroomsNumber(): ?int
254
    {
255
        return $this->bedrooms_number;
256
    }
257
258
    public function setBedroomsNumber(?int $bedrooms_number): self
259
    {
260
        $this->bedrooms_number = $bedrooms_number;
261
262
        return $this;
263
    }
264
265
    public function getAddress(): ?string
266
    {
267
        return $this->address;
268
    }
269
270
    public function setAddress(string $address): self
271
    {
272
        $this->address = $address;
273
274
        return $this;
275
    }
276
277
    public function getLatitude(): ?string
278
    {
279
        return $this->latitude;
280
    }
281
282
    public function setLatitude(?string $latitude): self
283
    {
284
        $this->latitude = $latitude;
285
286
        return $this;
287
    }
288
289
    public function getLongitude(): ?string
290
    {
291
        return $this->longitude;
292
    }
293
294
    public function setLongitude(?string $longitude): self
295
    {
296
        $this->longitude = $longitude;
297
298
        return $this;
299
    }
300
301
    public function getShowMap(): ?bool
302
    {
303
        return $this->show_map;
304
    }
305
306
    public function setShowMap(?bool $show_map): self
307
    {
308
        $this->show_map = $show_map;
309
310
        return $this;
311
    }
312
313
    public function getPrice(): ?int
314
    {
315
        return $this->price;
316
    }
317
318
    public function setPrice(?int $price): self
319
    {
320
        $this->price = $price;
321
322
        return $this;
323
    }
324
325
    public function getPriceType(): ?string
326
    {
327
        return $this->price_type;
328
    }
329
330
    public function setPriceType(?string $price_type): self
331
    {
332
        $this->price_type = $price_type;
333
334
        return $this;
335
    }
336
337
    public function getAvailableNow(): ?bool
338
    {
339
        return $this->available_now;
340
    }
341
342
    public function setAvailableNow(?bool $available_now): self
343
    {
344
        $this->available_now = $available_now;
345
346
        return $this;
347
    }
348
349
    public function getPhotos(): Collection
350
    {
351
        return $this->photos;
352
    }
353
354
    public function addPhoto(Photo $photo): self
355
    {
356
        if (!$this->photos->contains($photo)) {
357
            $this->photos[] = $photo;
358
            $photo->setProperty($this);
359
        }
360
361
        return $this;
362
    }
363
364
    public function removePhoto(Photo $photo): self
365
    {
366
        if ($this->photos->contains($photo)) {
367
            $this->photos->removeElement($photo);
368
            // set the owning side to null (unless already changed)
369
            if ($photo->getProperty() === $this) {
370
                $photo->setProperty(null);
371
            }
372
        }
373
374
        return $this;
375
    }
376
377
    public function getNeighborhood(): ?Neighborhood
378
    {
379
        return $this->neighborhood;
380
    }
381
382
    public function setNeighborhood(?Neighborhood $neighborhood): self
383
    {
384
        $this->neighborhood = $neighborhood;
385
386
        return $this;
387
    }
388
389
    public function getFeatures(): Collection
390
    {
391
        return $this->features;
392
    }
393
394
    public function addFeature(Feature $feature): self
395
    {
396
        if (!$this->features->contains($feature)) {
397
            $this->features[] = $feature;
398
        }
399
400
        return $this;
401
    }
402
403
    public function removeFeature(Feature $feature): self
404
    {
405
        if ($this->features->contains($feature)) {
406
            $this->features->removeElement($feature);
407
        }
408
409
        return $this;
410
    }
411
412
    public function getMetroStation(): ?Metro
413
    {
414
        return $this->metro_station;
415
    }
416
417
    public function setMetroStation(?Metro $metro_station): self
418
    {
419
        $this->metro_station = $metro_station;
420
421
        return $this;
422
    }
423
424
    public function getPriorityNumber(): ?int
425
    {
426
        return $this->priority_number;
427
    }
428
429
    public function setPriorityNumber(?int $priority_number): self
430
    {
431
        $this->priority_number = $priority_number;
432
433
        return $this;
434
    }
435
436
    public function getDistrict(): ?District
437
    {
438
        return $this->district;
439
    }
440
441
    public function setDistrict(?District $district): self
442
    {
443
        $this->district = $district;
444
445
        return $this;
446
    }
447
448
    public function getMaxGuests(): ?int
449
    {
450
        return $this->max_guests;
451
    }
452
453
    public function setMaxGuests(?int $max_guests): self
454
    {
455
        $this->max_guests = $max_guests;
456
457
        return $this;
458
    }
459
460
    public function getState(): ?string
461
    {
462
        return $this->state;
463
    }
464
465
    public function setState(string $state): self
466
    {
467
        $this->state = $state;
468
469
        return $this;
470
    }
471
472
    public function isPublished(): bool
473
    {
474
        return 'published' === $this->state;
475
    }
476
}
477