Completed
Push — master ( 543e67...844647 )
by
unknown
15s queued 11s
created

OfferCommandHandler::createLabel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace CultuurNet\UDB3\Offer;
4
5
use Broadway\Repository\RepositoryInterface;
6
use CultuurNet\UDB3\CommandHandling\Udb3CommandHandler;
7
use CultuurNet\UDB3\Label;
8
use CultuurNet\UDB3\Label\ReadModels\JSON\Repository\ReadRepositoryInterface;
9
use CultuurNet\UDB3\Label\ValueObjects\Visibility;
10
use CultuurNet\UDB3\Media\MediaManager;
11
use CultuurNet\UDB3\Media\MediaManagerInterface;
12
use CultuurNet\UDB3\Offer\Commands\AbstractAddLabel;
13
use CultuurNet\UDB3\Offer\Commands\AbstractDeleteCurrentOrganizer;
14
use CultuurNet\UDB3\Offer\Commands\AbstractImportLabels;
15
use CultuurNet\UDB3\Offer\Commands\AbstractLabelCommand;
16
use CultuurNet\UDB3\Offer\Commands\AbstractRemoveLabel;
17
use CultuurNet\UDB3\Offer\Commands\AbstractDeleteOffer;
18
use CultuurNet\UDB3\Offer\Commands\AbstractDeleteOrganizer;
19
use CultuurNet\UDB3\Offer\Commands\AbstractDeleteTypicalAgeRange;
20
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateBookingInfo;
21
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateCalendar;
22
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateContactPoint;
23
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateDescription;
24
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateFacilities;
25
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateOrganizer;
26
use CultuurNet\UDB3\Offer\Commands\AbstractUpdatePriceInfo;
27
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateTheme;
28
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateType;
29
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateTypicalAgeRange;
30
use CultuurNet\UDB3\Offer\Commands\Image\AbstractAddImage;
31
use CultuurNet\UDB3\Offer\Commands\Image\AbstractImportImages;
32
use CultuurNet\UDB3\Offer\Commands\Image\AbstractRemoveImage;
33
use CultuurNet\UDB3\Offer\Commands\Image\AbstractSelectMainImage;
34
use CultuurNet\UDB3\Offer\Commands\Image\AbstractUpdateImage;
35
use CultuurNet\UDB3\Offer\Commands\AbstractUpdateTitle;
36
use CultuurNet\UDB3\Offer\Commands\Moderation\AbstractApprove;
37
use CultuurNet\UDB3\Offer\Commands\Moderation\AbstractFlagAsDuplicate;
38
use CultuurNet\UDB3\Offer\Commands\Moderation\AbstractFlagAsInappropriate;
39
use CultuurNet\UDB3\Offer\Commands\Moderation\AbstractPublish;
40
use CultuurNet\UDB3\Offer\Commands\Moderation\AbstractReject;
41
use CultuurNet\UDB3\Organizer\Organizer;
42
use ValueObjects\StringLiteral\StringLiteral;
43
44
abstract class OfferCommandHandler extends Udb3CommandHandler
45
{
46
    /**
47
     * @var RepositoryInterface
48
     */
49
    protected $offerRepository;
50
51
    /**
52
     * @var RepositoryInterface
53
     */
54
    protected $organizerRepository;
55
56
    /**
57
     * @var RepositoryInterface
58
     */
59
    protected $labelRepository;
60
61
    /**
62
     * @var MediaManagerInterface|MediaManager
63
     */
64
    protected $mediaManager;
65
66
    /**
67
     * @param RepositoryInterface $offerRepository
68
     * @param RepositoryInterface $organizerRepository
69
     * @param ReadRepositoryInterface $labelRepository
70
     * @param MediaManagerInterface $mediaManager
71
     */
72
    public function __construct(
73
        RepositoryInterface $offerRepository,
74
        RepositoryInterface $organizerRepository,
75
        ReadRepositoryInterface $labelRepository,
76
        MediaManagerInterface $mediaManager
77
    ) {
78
        $this->offerRepository = $offerRepository;
79
        $this->organizerRepository = $organizerRepository;
80
        $this->labelRepository = $labelRepository;
0 ignored issues
show
Documentation Bug introduced by
It seems like $labelRepository of type object<CultuurNet\UDB3\L...eadRepositoryInterface> is incompatible with the declared type object<Broadway\Repository\RepositoryInterface> of property $labelRepository.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
81
        $this->mediaManager = $mediaManager;
82
    }
83
84
    /**
85
     * {@inheritdoc}
86
     */
87 View Code Duplication
    public function handle($command)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
88
    {
89
        $commandName = get_class($command);
90
        $commandHandlers = $this->getCommandHandlers();
91
92
        if (isset($commandHandlers[$commandName])) {
93
            $handler = $commandHandlers[$commandName];
94
            call_user_func(array($this, $handler), $command);
95
        } else {
96
            parent::handle($command);
97
        }
98
    }
99
100
    /**
101
     * @return string[]
102
     *   An associative array of commands and their handler methods.
103
     */
104 View Code Duplication
    private function getCommandHandlers()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
105
    {
106
        $commands = [];
107
108
        foreach (get_class_methods($this) as $method) {
109
            $matches = [];
110
            if (preg_match('/^handle(.+)$/', $method, $matches)) {
111
                $command = $matches[1];
112
                $classNameMethod = 'get' . $command . 'ClassName';
113
114
                if (method_exists($this, $classNameMethod)) {
115
                    $commandFullClassName = call_user_func(array($this, $classNameMethod));
116
                    $commands[$commandFullClassName] = $method;
117
                }
118
            }
119
        }
120
121
        return $commands;
122
    }
123
124
    /**
125
     * @return string
126
     */
127
    abstract protected function getAddLabelClassName();
128
129
    /**
130
     * @return string
131
     */
132
    abstract protected function getRemoveLabelClassName();
133
134
    /**
135
     * @return string
136
     */
137
    abstract protected function getImportLabelsClassName();
138
139
    /**
140
     * @return string
141
     */
142
    abstract protected function getUpdateTitleClassName();
143
144
    /**
145
     * @return string
146
     */
147
    abstract protected function getAddImageClassName();
148
149
    /**
150
     * @return string
151
     */
152
    abstract protected function getUpdateImageClassName();
153
154
    /**
155
     * @return string
156
     */
157
    abstract protected function getRemoveImageClassName();
158
159
    /**
160
     * @return string
161
     */
162
    abstract protected function getSelectMainImageClassName();
163
164
    /**
165
     * @return string
166
     */
167
    abstract protected function getImportImagesClassName();
168
169
    /**
170
     * @return string
171
     */
172
    abstract protected function getUpdateDescriptionClassName();
173
174
    /**
175
     * @return string
176
     */
177
    abstract protected function getUpdateCalendarClassName();
178
179
    /**
180
     * @return string
181
     */
182
    abstract protected function getUpdateTypicalAgeRangeClassName();
183
184
    /**
185
     * @return string
186
     */
187
    abstract protected function getDeleteTypicalAgeRangeClassName();
188
189
    /**
190
     * @return string
191
     */
192
    abstract protected function getUpdateOrganizerClassName();
193
194
    /**
195
     * @return string
196
     */
197
    abstract protected function getDeleteOrganizerClassName();
198
199
    /**
200
     * @return string
201
     */
202
    abstract protected function getDeleteCurrentOrganizerClassName();
203
204
    /**
205
     * @return string
206
     */
207
    abstract protected function getUpdateContactPointClassName();
208
209
    /**
210
     * @return string
211
     */
212
    abstract protected function getUpdateBookingInfoClassName();
213
214
    /**
215
     * @return string
216
     */
217
    abstract protected function getUpdatePriceInfoClassName();
218
219
    /**
220
     * @return string
221
     */
222
    abstract protected function getDeleteOfferClassName();
223
224
    /**
225
     * @return string
226
     */
227
    abstract protected function getPublishClassName();
228
229
    /**
230
     * @return string
231
     */
232
    abstract protected function getApproveClassName();
233
234
    /**
235
     * @return string
236
     */
237
    abstract protected function getRejectClassName();
238
239
    /**
240
     * @return string
241
     */
242
    abstract protected function getFlagAsDuplicateClassName();
243
244
    /**
245
     * @return string
246
     */
247
    abstract protected function getFlagAsInappropriateClassName();
248
249
    /**
250
     * @return string
251
     */
252
    abstract protected function getUpdateTypeClassName();
253
254
    /**
255
     * @return string
256
     */
257
    abstract protected function getUpdateThemeClassName();
258
259
    /**
260
     * @return string
261
     */
262
    abstract protected function getUpdateFacilitiesClassName();
263
264
    /**
265
     * @param AbstractUpdateType $updateType
266
     */
267
    public function handleUpdateType(AbstractUpdateType $updateType)
268
    {
269
        $offer = $this->load($updateType->getItemId());
270
271
        $offer->updateType($updateType->getType());
272
273
        $this->offerRepository->save($offer);
274
    }
275
276
    /**
277
     * @param AbstractUpdateTheme $updateTheme
278
     */
279
    public function handleUpdateTheme(AbstractUpdateTheme $updateTheme)
280
    {
281
        $offer = $this->load($updateTheme->getItemId());
282
283
        $offer->updateTheme($updateTheme->getTheme());
284
285
        $this->offerRepository->save($offer);
286
    }
287
288
    /**
289
     * @param AbstractUpdateFacilities $updateFacilities
290
     */
291
    public function handleUpdateFacilities(AbstractUpdateFacilities $updateFacilities)
292
    {
293
        $offer = $this->load($updateFacilities->getItemId());
294
295
        $offer->updateFacilities($updateFacilities->getFacilities());
296
297
        $this->offerRepository->save($offer);
298
    }
299
300
    /**
301
     * @param AbstractAddLabel $addLabel
302
     */
303
    private function handleAddLabel(AbstractAddLabel $addLabel)
304
    {
305
        $offer = $this->load($addLabel->getItemId());
306
307
        $labelName = (string) $addLabel->getLabel();
308
        $labelVisibility = $addLabel->getLabel()->isVisible();
309
310
        // Load the label read model so we can determine the correct visibility.
311
        $labelEntity = $this->labelRepository->getByName(new StringLiteral($labelName));
0 ignored issues
show
Bug introduced by
The method getByName() does not seem to exist on object<Broadway\Repository\RepositoryInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
312
        if ($labelEntity instanceof Label\ReadModels\JSON\Repository\Entity) {
313
            $labelVisibility = $labelEntity->getVisibility() === Visibility::VISIBLE();
314
        }
315
316
        $offer->addLabel(
317
            new Label($labelName, $labelVisibility)
318
        );
319
320
        $this->offerRepository->save($offer);
321
    }
322
323
    /**
324
     * @param AbstractRemoveLabel $removeLabel
325
     */
326
    private function handleRemoveLabel(AbstractRemoveLabel $removeLabel)
327
    {
328
        $offer = $this->load($removeLabel->getItemId());
329
330
        // Label visibility does not matter when removing, both the aggregate and the projectors remove the label from
331
        // both the visible and hidden label lists.
332
        $offer->removeLabel($removeLabel->getLabel());
333
334
        $this->offerRepository->save($offer);
335
    }
336
337
    /**
338
     * @param AbstractImportLabels $importLabels
339
     */
340
    private function handleImportLabels(AbstractImportLabels $importLabels)
341
    {
342
        $offer = $this->load($importLabels->getItemId());
343
344
        $offer->importLabels(
345
            $importLabels->getLabelsToImport(),
346
            $importLabels->getLabelsToKeepIfAlreadyOnOffer(),
347
            $importLabels->getLabelsToRemoveWhenOnOffer()
348
        );
349
350
        $this->offerRepository->save($offer);
351
    }
352
353
    /**
354
     * @param AbstractUpdateTitle $translateTitle
355
     */
356
    private function handleUpdateTitle(AbstractUpdateTitle $translateTitle)
357
    {
358
        $offer = $this->load($translateTitle->getItemId());
359
        $offer->updateTitle($translateTitle->getLanguage(), $translateTitle->getTitle());
0 ignored issues
show
Documentation introduced by
$translateTitle->getTitle() is of type string, but the function expects a object<CultuurNet\UDB3\Title>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
360
        $this->offerRepository->save($offer);
361
    }
362
363
    /**
364
     * Handle an add image command.
365
     * @param AbstractAddImage $addImage
366
     */
367
    public function handleAddImage(AbstractAddImage $addImage)
368
    {
369
        $offer = $this->load($addImage->getItemId());
370
371
        $image = $this->mediaManager->getImage($addImage->getImageId());
0 ignored issues
show
Bug introduced by
The method getImage does only exist in CultuurNet\UDB3\Media\MediaManager, but not in CultuurNet\UDB3\Media\MediaManagerInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
372
        $offer->addImage($image);
373
374
        $this->offerRepository->save($offer);
375
    }
376
377
    /**
378
     * @param AbstractRemoveImage $removeImage
379
     */
380
    public function handleRemoveImage(AbstractRemoveImage $removeImage)
381
    {
382
        $offer = $this->load($removeImage->getItemId());
383
        $offer->removeImage($removeImage->getImage());
384
        $this->offerRepository->save($offer);
385
    }
386
387
    /**
388
     * @param AbstractUpdateImage $updateImage
389
     */
390
    public function handleUpdateImage(AbstractUpdateImage $updateImage)
391
    {
392
        $offer = $this->load($updateImage->getItemId());
393
        $offer->updateImage(
394
            $updateImage->getMediaObjectId(),
395
            $updateImage->getDescription(),
396
            $updateImage->getCopyrightHolder()
397
        );
398
        $this->offerRepository->save($offer);
399
    }
400
401
    /**
402
     * @param AbstractSelectMainImage $selectMainImage
403
     */
404
    public function handleSelectMainImage(AbstractSelectMainImage $selectMainImage)
405
    {
406
        $offer = $this->load($selectMainImage->getItemId());
407
        $offer->selectMainImage($selectMainImage->getImage());
408
        $this->offerRepository->save($offer);
409
    }
410
411
    /**
412
     * @param AbstractImportImages $importImages
413
     */
414
    public function handleImportImages(AbstractImportImages $importImages)
415
    {
416
        $offer = $this->load($importImages->getItemId());
417
        $offer->importImages($importImages->getImages());
418
        $this->offerRepository->save($offer);
419
    }
420
421
    /**
422
     * Handle the update of description on a place.
423
     * @param AbstractUpdateDescription $updateDescription
424
     */
425
    public function handleUpdateDescription(AbstractUpdateDescription $updateDescription)
426
    {
427
        $offer = $this->load($updateDescription->getItemId());
428
429
        $offer->updateDescription(
430
            $updateDescription->getDescription(),
431
            $updateDescription->getLanguage()
432
        );
433
434
        $this->offerRepository->save($offer);
435
436
    }
437
438
    /**
439
     * @param AbstractUpdateCalendar $updateCalendar
440
     */
441
    public function handleUpdateCalendar(AbstractUpdateCalendar $updateCalendar)
442
    {
443
        $offer = $this->load($updateCalendar->getItemId());
444
445
        $offer->updateCalendar($updateCalendar->getCalendar());
446
447
        $this->offerRepository->save($offer);
448
    }
449
450
    /**
451
     * Handle the update of typical age range on a place.
452
     * @param AbstractUpdateTypicalAgeRange $updateTypicalAgeRange
453
     */
454
    public function handleUpdateTypicalAgeRange(AbstractUpdateTypicalAgeRange $updateTypicalAgeRange)
455
    {
456
        $offer = $this->load($updateTypicalAgeRange->getItemId());
457
458
        $offer->updateTypicalAgeRange(
459
            $updateTypicalAgeRange->getTypicalAgeRange()
0 ignored issues
show
Documentation introduced by
$updateTypicalAgeRange->getTypicalAgeRange() is of type string, but the function expects a object<CultuurNet\UDB3\Offer\AgeRange>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
460
        );
461
462
        $this->offerRepository->save($offer);
463
464
    }
465
466
    /**
467
     * Handle the deletion of typical age range on a place.
468
     * @param AbstractDeleteTypicalAgeRange $deleteTypicalAgeRange
469
     */
470
    public function handleDeleteTypicalAgeRange(AbstractDeleteTypicalAgeRange $deleteTypicalAgeRange)
471
    {
472
        $offer = $this->load($deleteTypicalAgeRange->getItemId());
473
474
        $offer->deleteTypicalAgeRange();
475
476
        $this->offerRepository->save($offer);
477
478
    }
479
480
    /**
481
     * Handle an update command to update organizer of a place.
482
     * @param AbstractUpdateOrganizer $updateOrganizer
483
     */
484
    public function handleUpdateOrganizer(AbstractUpdateOrganizer $updateOrganizer)
485
    {
486
        $offer = $this->load($updateOrganizer->getItemId());
487
        $this->loadOrganizer($updateOrganizer->getOrganizerId());
488
489
        $offer->updateOrganizer(
490
            $updateOrganizer->getOrganizerId()
491
        );
492
493
        $this->offerRepository->save($offer);
494
    }
495
496
    /**
497
     * Handle an update command to delete the organizer.
498
     * @param AbstractDeleteOrganizer $deleteOrganizer
499
     */
500
    public function handleDeleteOrganizer(AbstractDeleteOrganizer $deleteOrganizer)
501
    {
502
        $offer = $this->load($deleteOrganizer->getItemId());
503
504
        $offer->deleteOrganizer(
505
            $deleteOrganizer->getOrganizerId()
506
        );
507
508
        $this->offerRepository->save($offer);
509
    }
510
511
    /**
512
     * @param AbstractDeleteCurrentOrganizer $deleteCurrentOrganizer
513
     */
514
    public function handleDeleteCurrentOrganizer(AbstractDeleteCurrentOrganizer $deleteCurrentOrganizer)
515
    {
516
        $offer = $this->load($deleteCurrentOrganizer->getItemId());
517
518
        $offer->deleteCurrentOrganizer();
519
520
        $this->offerRepository->save($offer);
521
    }
522
523
    /**
524
     * Handle an update command to updated the contact point.
525
     * @param AbstractUpdateContactPoint $updateContactPoint
526
     */
527
    public function handleUpdateContactPoint(AbstractUpdateContactPoint $updateContactPoint)
528
    {
529
        $offer = $this->load($updateContactPoint->getItemId());
530
531
        $offer->updateContactPoint(
532
            $updateContactPoint->getContactPoint()
533
        );
534
535
        $this->offerRepository->save($offer);
536
537
    }
538
539
    /**
540
     * Handle an update command to updated the booking info.
541
     * @param AbstractUpdateBookingInfo $updateBookingInfo
542
     */
543
    public function handleUpdateBookingInfo(AbstractUpdateBookingInfo $updateBookingInfo)
544
    {
545
        $offer = $this->load($updateBookingInfo->getItemId());
546
547
        $offer->updateBookingInfo(
548
            $updateBookingInfo->getBookingInfo()
549
        );
550
551
        $this->offerRepository->save($offer);
552
    }
553
554
    /**
555
     * @param AbstractUpdatePriceInfo $updatePriceInfo
556
     */
557
    private function handleUpdatePriceInfo(AbstractUpdatePriceInfo $updatePriceInfo)
558
    {
559
        $offer = $this->load($updatePriceInfo->getItemId());
560
561
        $offer->updatePriceInfo(
562
            $updatePriceInfo->getPriceInfo()
563
        );
564
565
        $this->offerRepository->save($offer);
566
    }
567
568
    /**
569
     * @param AbstractDeleteOffer $deleteOffer
570
     */
571
    private function handleDeleteOffer(AbstractDeleteOffer $deleteOffer)
572
    {
573
        $offer = $this->load($deleteOffer->getItemId());
574
        $offer->delete();
575
        $this->offerRepository->save($offer);
576
    }
577
578
    /**
579
     * @param AbstractPublish $publish
580
     */
581
    private function handlePublish(AbstractPublish $publish)
582
    {
583
        $offer = $this->load($publish->getItemId());
584
        $offer->publish($publish->getPublicationDate());
585
        $this->offerRepository->save($offer);
586
    }
587
588
    /**
589
     * @param AbstractApprove $approve
590
     */
591
    private function handleApprove(AbstractApprove $approve)
592
    {
593
        $offer = $this->load($approve->getItemId());
594
        $offer->approve();
595
        $this->offerRepository->save($offer);
596
    }
597
598
    /**
599
     * @param AbstractReject $reject
600
     */
601
    private function handleReject(AbstractReject $reject)
602
    {
603
        $offer = $this->load($reject->getItemId());
604
        $offer->reject($reject->getReason());
605
        $this->offerRepository->save($offer);
606
    }
607
608
    /**
609
     * @param AbstractFlagAsDuplicate $flagAsDuplicate
610
     */
611
    private function handleFlagAsDuplicate(AbstractFlagAsDuplicate $flagAsDuplicate)
612
    {
613
        $offer = $this->load($flagAsDuplicate->getItemId());
614
        $offer->flagAsDuplicate();
615
        $this->offerRepository->save($offer);
616
    }
617
618
    /**
619
     * @param AbstractFlagAsInappropriate $flagAsInappropriate
620
     */
621
    private function handleFlagAsInappropriate(AbstractFlagAsInappropriate $flagAsInappropriate)
622
    {
623
        $offer = $this->load($flagAsInappropriate->getItemId());
624
        $offer->flagAsInappropriate();
625
        $this->offerRepository->save($offer);
626
    }
627
628
    /**
629
     * Makes it easier to type-hint to Offer.
630
     *
631
     * @param string $id
632
     * @return Offer
633
     */
634
    private function load($id)
635
    {
636
        return $this->offerRepository->load($id);
637
    }
638
639
    /**
640
     * Makes it easier to type-hint to Organizer.
641
     *
642
     * @param string $id
643
     * @return Organizer
644
     */
645
    private function loadOrganizer($id)
646
    {
647
        return $this->organizerRepository->load($id);
648
649
    }
650
}
651