1 | <?php |
||
20 | class DefaultOfferEditingService implements OfferEditingServiceInterface |
||
21 | { |
||
22 | /** |
||
23 | * @var CommandBusInterface |
||
24 | */ |
||
25 | protected $commandBus; |
||
26 | |||
27 | /** |
||
28 | * @var UuidGeneratorInterface |
||
29 | */ |
||
30 | protected $uuidGenerator; |
||
31 | |||
32 | /** |
||
33 | * @var DocumentRepositoryInterface |
||
34 | */ |
||
35 | protected $readRepository; |
||
36 | |||
37 | /** |
||
38 | * @var OfferCommandFactoryInterface |
||
39 | */ |
||
40 | protected $commandFactory; |
||
41 | |||
42 | /** |
||
43 | * @var LabelServiceInterface |
||
44 | */ |
||
45 | private $labelService; |
||
46 | |||
47 | /** |
||
48 | * @var \DateTimeImmutable|null |
||
49 | */ |
||
50 | protected $publicationDate; |
||
51 | |||
52 | /** |
||
53 | * @param CommandBusInterface $commandBus |
||
54 | * @param UuidGeneratorInterface $uuidGenerator |
||
55 | * @param DocumentRepositoryInterface $readRepository |
||
56 | * @param OfferCommandFactoryInterface $commandFactory |
||
57 | * @param LabelServiceInterface $labelService |
||
58 | */ |
||
59 | public function __construct( |
||
73 | |||
74 | /** |
||
75 | * @param \DateTimeImmutable $publicationDate |
||
76 | * @return static |
||
77 | */ |
||
78 | public function withFixedPublicationDateForNewOffers( |
||
85 | |||
86 | /** |
||
87 | * @param $id |
||
88 | * @param Label $label |
||
89 | * @return string |
||
90 | */ |
||
91 | public function addLabel($id, Label $label) |
||
107 | |||
108 | /** |
||
109 | * @param $id |
||
110 | * @param Label $label |
||
111 | * @return string |
||
112 | */ |
||
113 | public function removeLabel($id, Label $label) |
||
124 | |||
125 | /** |
||
126 | * @param $id |
||
127 | * @param Language $language |
||
128 | * @param StringLiteral $title |
||
129 | * @return string |
||
130 | */ |
||
131 | public function updateTitle($id, Language $language, StringLiteral $title) |
||
132 | { |
||
133 | $this->guardId($id); |
||
134 | |||
135 | return $this->commandBus->dispatch( |
||
136 | $this->commandFactory->createUpdateTitleCommand( |
||
137 | $id, |
||
138 | $language, |
||
139 | $title |
||
140 | ) |
||
141 | ); |
||
142 | } |
||
143 | |||
144 | /** |
||
145 | * @param $id |
||
146 | * @param Language $language |
||
147 | * @param Description $description |
||
148 | * @return string |
||
149 | */ |
||
150 | public function updateDescription($id, Language $language, Description $description) |
||
162 | |||
163 | /** |
||
164 | * @param string $id |
||
165 | * @param Image $image |
||
166 | * @return string |
||
167 | */ |
||
168 | public function addImage($id, Image $image) |
||
176 | |||
177 | /** |
||
178 | * @param string $id |
||
179 | * @param Image $image |
||
180 | * @param StringLiteral $description |
||
181 | * @param StringLiteral $copyrightHolder |
||
182 | * @return string |
||
183 | */ |
||
184 | public function updateImage( |
||
201 | |||
202 | /** |
||
203 | * @param $id |
||
204 | * Id of the offer to remove the image from. |
||
205 | * |
||
206 | * @param Image $image |
||
207 | * The image that should be removed. |
||
208 | * |
||
209 | * @return string |
||
210 | */ |
||
211 | public function removeImage($id, Image $image) |
||
219 | |||
220 | /** |
||
221 | * @param $id |
||
222 | * @param Image $image |
||
223 | * @return string |
||
224 | */ |
||
225 | public function selectMainImage($id, Image $image) |
||
233 | |||
234 | /** |
||
235 | * @param string $id |
||
236 | * @param AgeRange $ageRange |
||
237 | * @return string |
||
238 | */ |
||
239 | public function updateTypicalAgeRange($id, AgeRange $ageRange) |
||
247 | |||
248 | /** |
||
249 | * @param string $id |
||
250 | * @return string |
||
251 | */ |
||
252 | public function deleteTypicalAgeRange($id) |
||
261 | |||
262 | /** |
||
263 | * @param string $id |
||
264 | * @param string $organizerId |
||
265 | * @return string |
||
266 | */ |
||
267 | public function updateOrganizer($id, $organizerId) |
||
275 | |||
276 | /** |
||
277 | * @param string $id |
||
278 | * @param string $organizerId |
||
279 | * @return string |
||
280 | */ |
||
281 | public function deleteOrganizer($id, $organizerId) |
||
289 | |||
290 | /** |
||
291 | * @param string $id |
||
292 | * @param ContactPoint $contactPoint |
||
293 | * @return string |
||
294 | */ |
||
295 | public function updateContactPoint($id, ContactPoint $contactPoint) |
||
304 | |||
305 | /** |
||
306 | * @param string $id |
||
307 | * @param BookingInfo $bookingInfo |
||
308 | * @return string |
||
309 | */ |
||
310 | public function updateBookingInfo($id, BookingInfo $bookingInfo) |
||
318 | |||
319 | /** |
||
320 | * @param $id |
||
321 | * @param PriceInfo $priceInfo |
||
322 | */ |
||
323 | public function updatePriceInfo($id, PriceInfo $priceInfo) |
||
331 | |||
332 | /** |
||
333 | * @param string $id |
||
334 | * @return string |
||
335 | */ |
||
336 | public function delete($id) |
||
342 | |||
343 | /** |
||
344 | * @param string $id |
||
345 | */ |
||
346 | public function guardId($id) |
||
350 | } |
||
351 |