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