1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Application\Model; |
6
|
|
|
|
7
|
|
|
use Application\DBAL\Types\BookingTypeType; |
8
|
|
|
use Application\Traits\HasCode; |
9
|
|
|
use Application\Traits\HasDescription; |
10
|
|
|
use Application\Traits\HasName; |
11
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
12
|
|
|
use Doctrine\Common\Collections\Collection; |
13
|
|
|
use Doctrine\ORM\Mapping as ORM; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* An item that can be booked by a user |
17
|
|
|
* |
18
|
|
|
* @ORM\Entity(repositoryClass="Application\Repository\BookableRepository") |
19
|
|
|
*/ |
20
|
|
|
class Bookable extends AbstractModel |
21
|
|
|
{ |
22
|
|
|
use HasName; |
23
|
|
|
use HasDescription; |
24
|
|
|
use HasCode; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string |
28
|
|
|
* |
29
|
|
|
* @ORM\Column(type="decimal", length=10, options={"default" = "0"}) |
30
|
|
|
*/ |
31
|
|
|
private $initialPrice = '0.00'; |
|
|
|
|
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
* |
36
|
|
|
* @ORM\Column(type="decimal", length=10, options={"default" = "0"}) |
37
|
|
|
*/ |
38
|
|
|
private $periodicPrice = '0.00'; |
|
|
|
|
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var int |
42
|
|
|
* |
43
|
|
|
* @ORM\Column(type="smallint", options={"unsigned" = true, "default" = "1"}) |
44
|
|
|
*/ |
45
|
|
|
private $simultaneousBookingMaximum = 1; |
|
|
|
|
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var string |
49
|
|
|
* |
50
|
|
|
* @ORM\Column(type="BookingType", length=10, options={"default" = BookingTypeType::SELF_APPROVED}) |
51
|
|
|
*/ |
52
|
|
|
private $bookingType = BookingTypeType::SELF_APPROVED; |
|
|
|
|
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var Collection |
56
|
|
|
* @ORM\ManyToMany(targetEntity="Application\Model\Booking", mappedBy="bookables") |
57
|
|
|
*/ |
58
|
|
|
private $bookings; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var Collection |
62
|
|
|
* @ORM\ManyToMany(targetEntity="License", mappedBy="bookables") |
63
|
|
|
*/ |
64
|
|
|
private $tags; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Constructor |
68
|
|
|
*/ |
69
|
|
|
public function __construct() |
70
|
|
|
{ |
71
|
|
|
$this->bookings = new ArrayCollection(); |
72
|
|
|
$this->tags = new ArrayCollection(); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return Collection |
77
|
|
|
*/ |
78
|
|
|
public function getBookings(): Collection |
79
|
|
|
{ |
80
|
|
|
return $this->bookings; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return Collection |
85
|
|
|
*/ |
86
|
|
|
public function getTags(): Collection |
87
|
|
|
{ |
88
|
|
|
return $this->tags; |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|