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