1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace CultuurNet\UDB3\Place\Commands; |
4
|
|
|
|
5
|
|
|
use CultuurNet\UDB3\BookingInfo; |
6
|
|
|
use CultuurNet\UDB3\Calendar; |
7
|
|
|
use CultuurNet\UDB3\ContactPoint; |
8
|
|
|
use CultuurNet\UDB3\Description; |
9
|
|
|
use CultuurNet\UDB3\Event\EventType; |
10
|
|
|
use CultuurNet\UDB3\Label; |
11
|
|
|
use CultuurNet\UDB3\Media\Image; |
12
|
|
|
use CultuurNet\UDB3\Language; |
13
|
|
|
use CultuurNet\UDB3\Offer\AgeRange; |
14
|
|
|
use CultuurNet\UDB3\Offer\Commands\AbstractDeleteOffer; |
15
|
|
|
use CultuurNet\UDB3\Offer\Commands\AbstractDeleteOrganizer; |
16
|
|
|
use CultuurNet\UDB3\Offer\Commands\AbstractDeleteTypicalAgeRange; |
17
|
|
|
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateTitle; |
18
|
|
|
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateBookingInfo; |
19
|
|
|
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateContactPoint; |
20
|
|
|
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateDescription; |
21
|
|
|
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateOrganizer; |
22
|
|
|
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateTypicalAgeRange; |
23
|
|
|
use CultuurNet\UDB3\Offer\Commands\Image\AbstractSelectMainImage; |
24
|
|
|
use CultuurNet\UDB3\Offer\Commands\OfferCommandFactoryInterface; |
25
|
|
|
use CultuurNet\UDB3\Place\Commands\Moderation\Approve; |
26
|
|
|
use CultuurNet\UDB3\Place\Commands\Moderation\FlagAsDuplicate; |
27
|
|
|
use CultuurNet\UDB3\Place\Commands\Moderation\FlagAsInappropriate; |
28
|
|
|
use CultuurNet\UDB3\Place\Commands\Moderation\Reject; |
29
|
|
|
use CultuurNet\UDB3\PriceInfo\PriceInfo; |
30
|
|
|
use CultuurNet\UDB3\Theme; |
31
|
|
|
use ValueObjects\Identity\UUID; |
32
|
|
|
use ValueObjects\StringLiteral\StringLiteral; |
33
|
|
|
|
34
|
|
|
class PlaceCommandFactory implements OfferCommandFactoryInterface |
35
|
|
|
{ |
36
|
|
|
/** |
37
|
|
|
* @param $id |
38
|
|
|
* @param Label $label |
39
|
|
|
* @return AddLabel |
40
|
|
|
*/ |
41
|
|
|
public function createAddLabelCommand($id, Label $label) |
42
|
|
|
{ |
43
|
|
|
return new AddLabel($id, $label); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param $id |
48
|
|
|
* @param Label $label |
49
|
|
|
* @return RemoveLabel |
50
|
|
|
*/ |
51
|
|
|
public function createRemoveLabelCommand($id, Label $label) |
52
|
|
|
{ |
53
|
|
|
return new RemoveLabel($id, $label); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
|
57
|
|
|
public function createAddImageCommand($id, Image $image) |
58
|
|
|
{ |
59
|
|
|
return new AddImage($id, $image); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function createRemoveImageCommand($id, Image $image) |
63
|
|
|
{ |
64
|
|
|
return new RemoveImage($id, $image); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function createUpdateImageCommand( |
68
|
|
|
$id, |
69
|
|
|
UUID $mediaObjectId, |
70
|
|
|
StringLiteral $description, |
71
|
|
|
StringLiteral $copyrightHolder |
72
|
|
|
) { |
73
|
|
|
return new UpdateImage( |
74
|
|
|
$id, |
75
|
|
|
$mediaObjectId, |
76
|
|
|
$description, |
77
|
|
|
$copyrightHolder |
78
|
|
|
); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function createSelectMainImage($id, Image $image) |
82
|
|
|
{ |
83
|
|
|
return new SelectMainImage($id, $image); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @param $id |
88
|
|
|
* @param Language $language |
89
|
|
|
* @param StringLiteral $title |
90
|
|
|
* @return AbstractUpdateTitle |
91
|
|
|
*/ |
92
|
|
|
public function createUpdateTitleCommand($id, Language $language, StringLiteral $title) |
93
|
|
|
{ |
94
|
|
|
return new UpdateTitle($id, $language, $title); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @param $id |
99
|
|
|
* @param Language $language |
100
|
|
|
* @param Description $description |
101
|
|
|
* @return AbstractUpdateDescription |
102
|
|
|
*/ |
103
|
|
|
public function createUpdateDescriptionCommand($id, Language $language, Description $description) |
104
|
|
|
{ |
105
|
|
|
return new UpdateDescription($id, $language, $description); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @inheritdoc |
110
|
|
|
*/ |
111
|
|
|
public function createUpdateCalendarCommand($id, Calendar $calendar) |
112
|
|
|
{ |
113
|
|
|
return new UpdateCalendar($id, $calendar); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @param $id |
118
|
|
|
* @param Image $image |
119
|
|
|
* @return AbstractSelectMainImage |
120
|
|
|
*/ |
121
|
|
|
public function createSelectMainImageCommand($id, Image $image) |
122
|
|
|
{ |
123
|
|
|
return new SelectMainImage($id, $image); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @param string $id |
128
|
|
|
* @param AgeRange $ageRange |
129
|
|
|
* @return AbstractUpdateTypicalAgeRange |
130
|
|
|
*/ |
131
|
|
|
public function createUpdateTypicalAgeRangeCommand($id, AgeRange $ageRange) |
132
|
|
|
{ |
133
|
|
|
return new UpdateTypicalAgeRange($id, $ageRange); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @param string $id |
138
|
|
|
* @return AbstractDeleteTypicalAgeRange |
139
|
|
|
*/ |
140
|
|
|
public function createDeleteTypicalAgeRangeCommand($id) |
141
|
|
|
{ |
142
|
|
|
return new DeleteTypicalAgeRange($id); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @param string $id |
147
|
|
|
* @param string $organizerId |
148
|
|
|
* @return AbstractUpdateOrganizer |
149
|
|
|
*/ |
150
|
|
|
public function createUpdateOrganizerCommand($id, $organizerId) |
151
|
|
|
{ |
152
|
|
|
return new UpdateOrganizer($id, $organizerId); |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @param string $id |
157
|
|
|
* @param string $organizerId |
158
|
|
|
* @return AbstractDeleteOrganizer |
159
|
|
|
*/ |
160
|
|
|
public function createDeleteOrganizerCommand($id, $organizerId) |
161
|
|
|
{ |
162
|
|
|
return new DeleteOrganizer($id, $organizerId); |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @param string $id |
167
|
|
|
* @param ContactPoint $contactPoint |
168
|
|
|
* @return AbstractUpdateContactPoint |
169
|
|
|
*/ |
170
|
|
|
public function createUpdateContactPointCommand($id, ContactPoint $contactPoint) |
171
|
|
|
{ |
172
|
|
|
return new UpdateContactPoint($id, $contactPoint); |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @param string $id |
177
|
|
|
* @param BookingInfo $bookingInfo |
178
|
|
|
* @return AbstractUpdateBookingInfo |
179
|
|
|
*/ |
180
|
|
|
public function createUpdateBookingInfoCommand($id, BookingInfo $bookingInfo) |
181
|
|
|
{ |
182
|
|
|
return new UpdateBookingInfo($id, $bookingInfo); |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* @param $id |
187
|
|
|
* @param PriceInfo $priceInfo |
188
|
|
|
* @return UpdatePriceInfo |
189
|
|
|
*/ |
190
|
|
|
public function createUpdatePriceInfoCommand($id, PriceInfo $priceInfo) |
191
|
|
|
{ |
192
|
|
|
return new UpdatePriceInfo($id, $priceInfo); |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @param string $id |
197
|
|
|
* @return AbstractDeleteOffer |
198
|
|
|
*/ |
199
|
|
|
public function createDeleteOfferCommand($id) |
200
|
|
|
{ |
201
|
|
|
return new DeletePlace($id); |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* @param string $id |
206
|
|
|
* @return Approve |
207
|
|
|
*/ |
208
|
|
|
public function createApproveCommand($id) |
209
|
|
|
{ |
210
|
|
|
return new Approve($id); |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* @param string $id |
215
|
|
|
* @param StringLiteral $reason |
216
|
|
|
* @return Reject |
217
|
|
|
*/ |
218
|
|
|
public function createRejectCommand($id, StringLiteral $reason) |
219
|
|
|
{ |
220
|
|
|
return new Reject($id, $reason); |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* @param string $id |
225
|
|
|
* @return FlagAsInappropriate |
226
|
|
|
*/ |
227
|
|
|
public function createFlagAsInappropriate($id) |
228
|
|
|
{ |
229
|
|
|
return new FlagAsInappropriate($id); |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* @param string $id |
234
|
|
|
* @return FlagAsDuplicate |
235
|
|
|
*/ |
236
|
|
|
public function createFlagAsDuplicate($id) |
237
|
|
|
{ |
238
|
|
|
return new FlagAsDuplicate($id); |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
public function createUpdateTypeCommand($id, EventType $type) |
242
|
|
|
{ |
243
|
|
|
return new UpdateType($id, $type); |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
public function createUpdateThemeCommand($id, Theme $theme) |
247
|
|
|
{ |
248
|
|
|
return new UpdateTheme($id, $theme); |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* @inheritdoc |
253
|
|
|
*/ |
254
|
|
|
public function createUpdateFacilitiesCommand($id, array $facilities) |
255
|
|
|
{ |
256
|
|
|
return new UpdateFacilities($id, $facilities); |
257
|
|
|
} |
258
|
|
|
} |
259
|
|
|
|