1 | <?php |
||
58 | class Reservation implements EntityInterface, GetMemberInterface |
||
59 | { |
||
60 | use Traits\PropertyIdGeneratedTrait; |
||
61 | |||
62 | /** |
||
63 | * @var \DateTimeImmutable |
||
64 | * @ORM\Column(name="date", type="date_immutable", nullable=false) |
||
65 | * |
||
66 | * @Assert\Date() |
||
67 | * |
||
68 | * @Serializer\Groups({"get"}) |
||
69 | * @OA\ApiProperty( |
||
70 | * attributes={ |
||
71 | * "swagger_context"={"type"="string", "format"="date", "example"="2000-01-01"}, |
||
72 | * "normalization_context"={"date_format"="Y-m-d", "datetime_format"="Y-m-d"}, |
||
73 | * } |
||
74 | * ) |
||
75 | * @OA\ApiFilter( |
||
76 | * ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter::class, |
||
77 | * strategy="ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter::INCLUDE_NULL_BEFORE" |
||
78 | * ) |
||
79 | * @OA\ApiFilter( |
||
80 | * ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter::class, |
||
81 | * strategy="exact" |
||
82 | * ) |
||
83 | */ |
||
84 | private $date; |
||
85 | |||
86 | /** |
||
87 | * @var string |
||
88 | * @ORM\Column(name="type", type="string", length=50, nullable=false) |
||
89 | * |
||
90 | * @Assert\NotBlank() |
||
91 | * @Assert\Type("string") |
||
92 | * @Assert\Length(min="1", max="50") |
||
93 | * |
||
94 | * @Serializer\Groups({"get"}) |
||
95 | * @OA\ApiProperty( |
||
96 | * attributes={ |
||
97 | * "swagger_context"={"type"="string", "enum"={"REVOKED","ASSIGNED"}, "example"="REVOKED"}, |
||
98 | * } |
||
99 | * ) |
||
100 | * @OA\ApiFilter( |
||
101 | * ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter::class, |
||
102 | * strategy="exact" |
||
103 | * ) |
||
104 | */ |
||
105 | private $type; |
||
106 | |||
107 | /** |
||
108 | * @var int |
||
109 | * @ORM\Column(name="places", type="integer", nullable=false) |
||
110 | * |
||
111 | * @Assert\PositiveOrZero() |
||
112 | * |
||
113 | * @Serializer\Groups({"get"}) |
||
114 | * @OA\ApiProperty( |
||
115 | * attributes={ |
||
116 | * "swagger_context"={"type"="integer", "example"=1}, |
||
117 | * } |
||
118 | * ) |
||
119 | * @OA\ApiFilter( |
||
120 | * ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\RangeFilter::class |
||
121 | * ) |
||
122 | * @OA\ApiFilter( |
||
123 | * ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter::class, |
||
124 | * strategy="exact" |
||
125 | * ) |
||
126 | */ |
||
127 | private $places; |
||
128 | |||
129 | //------------------------------------------------------------------------------------------- |
||
130 | |||
131 | /** |
||
132 | * @var Member |
||
133 | * @ORM\ManyToOne(targetEntity="App\Entity\Parking\Member") |
||
134 | * @ORM\JoinColumn(name="member_id", referencedColumnName="id") |
||
135 | * |
||
136 | * @Assert\NotNull() |
||
137 | * |
||
138 | * @Serializer\Groups({"get"}) |
||
139 | * @OA\ApiSubresource() |
||
140 | * @OA\ApiProperty( |
||
141 | * attributes={ |
||
142 | * "swagger_context"={"type"="string", "example"="id"}, |
||
143 | * } |
||
144 | * ) |
||
145 | * @OA\ApiFilter( |
||
146 | * ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter::class, |
||
147 | * strategy="exact" |
||
148 | * ) |
||
149 | * @OA\ApiFilter( |
||
150 | * ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter::class, |
||
151 | * strategy="exact", |
||
152 | * properties={"member.id"} |
||
153 | * ) |
||
154 | */ |
||
155 | protected $member; |
||
156 | |||
157 | //------------------------------------------------------------------------------------------- |
||
158 | |||
159 | 1 | public function __construct(Member $member, \DateTimeImmutable $date, int $places, ReservationTypeEnum $type) |
|
167 | |||
168 | //------------------------------------------------------------------------------------------- |
||
169 | |||
170 | 1 | public function getDate(): \DateTimeImmutable |
|
174 | |||
175 | 1 | public function getMember(): Member |
|
179 | |||
180 | 1 | public function getPlaces(): int |
|
184 | |||
185 | 1 | public function setPlaces(int $places): self |
|
191 | |||
192 | 1 | public function getType(): ReservationTypeEnum |
|
196 | |||
197 | 1 | public function setType(ReservationTypeEnum $type): self |
|
203 | } |
||
204 |