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