@@ 5-34 (lines=30) @@ | ||
2 | ||
3 | namespace CultuurNet\UDB3\Offer\Events; |
|
4 | ||
5 | abstract class AbstractEventWithIri extends AbstractEvent |
|
6 | { |
|
7 | /** |
|
8 | * @var string |
|
9 | */ |
|
10 | private $iri; |
|
11 | ||
12 | final public function __construct(string $itemId, $iri) |
|
13 | { |
|
14 | parent::__construct($itemId); |
|
15 | $this->iri = (string) $iri; |
|
16 | } |
|
17 | ||
18 | public function getIri(): string |
|
19 | { |
|
20 | return $this->iri; |
|
21 | } |
|
22 | ||
23 | public function serialize(): array |
|
24 | { |
|
25 | return parent::serialize() + array( |
|
26 | 'iri' => $this->iri, |
|
27 | ); |
|
28 | } |
|
29 | ||
30 | public static function deserialize(array $data): AbstractEventWithIri |
|
31 | { |
|
32 | return new static($data['item_id'], $data['iri']); |
|
33 | } |
|
34 | } |
|
35 |
@@ 5-37 (lines=33) @@ | ||
2 | ||
3 | namespace CultuurNet\UDB3\Offer\Events; |
|
4 | ||
5 | abstract class AbstractOrganizerEvent extends AbstractEvent |
|
6 | { |
|
7 | /** |
|
8 | * @var string |
|
9 | */ |
|
10 | protected $organizerId; |
|
11 | ||
12 | final public function __construct(string $id, $organizerId) |
|
13 | { |
|
14 | parent::__construct($id); |
|
15 | $this->organizerId = $organizerId; |
|
16 | } |
|
17 | ||
18 | public function getOrganizerId(): string |
|
19 | { |
|
20 | return $this->organizerId; |
|
21 | } |
|
22 | ||
23 | public function serialize(): array |
|
24 | { |
|
25 | return parent::serialize() + array( |
|
26 | 'organizerId' => $this->organizerId, |
|
27 | ); |
|
28 | } |
|
29 | ||
30 | public static function deserialize(array $data): AbstractOrganizerEvent |
|
31 | { |
|
32 | return new static( |
|
33 | $data['item_id'], |
|
34 | $data['organizerId'] |
|
35 | ); |
|
36 | } |
|
37 | } |
|
38 |
@@ 7-43 (lines=37) @@ | ||
4 | ||
5 | use CultuurNet\UDB3\Theme; |
|
6 | ||
7 | abstract class AbstractThemeUpdated extends AbstractEvent |
|
8 | { |
|
9 | /** |
|
10 | * @var Theme |
|
11 | */ |
|
12 | protected $theme; |
|
13 | ||
14 | /** |
|
15 | * @param string $itemId |
|
16 | * @param Theme $theme |
|
17 | */ |
|
18 | final public function __construct($itemId, Theme $theme) |
|
19 | { |
|
20 | parent::__construct($itemId); |
|
21 | $this->theme = $theme; |
|
22 | } |
|
23 | ||
24 | public function getTheme(): Theme |
|
25 | { |
|
26 | return $this->theme; |
|
27 | } |
|
28 | ||
29 | public function serialize(): array |
|
30 | { |
|
31 | return parent::serialize() + [ |
|
32 | 'theme' => $this->theme->serialize(), |
|
33 | ]; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * @inheritdoc |
|
38 | */ |
|
39 | public static function deserialize(array $data) |
|
40 | { |
|
41 | return new static($data['item_id'], Theme::deserialize($data['theme'])); |
|
42 | } |
|
43 | } |
|
44 |
@@ 7-36 (lines=30) @@ | ||
4 | ||
5 | use CultuurNet\UDB3\Place\PlaceEvent; |
|
6 | ||
7 | final class MarkedAsDuplicate extends PlaceEvent |
|
8 | { |
|
9 | /** |
|
10 | * @var string |
|
11 | */ |
|
12 | private $duplicateOf; |
|
13 | ||
14 | public function __construct(string $placeId, string $duplicateOf) |
|
15 | { |
|
16 | parent::__construct($placeId); |
|
17 | $this->duplicateOf = $duplicateOf; |
|
18 | } |
|
19 | ||
20 | public function getDuplicateOf(): string |
|
21 | { |
|
22 | return $this->duplicateOf; |
|
23 | } |
|
24 | ||
25 | public function serialize(): array |
|
26 | { |
|
27 | return parent::serialize() + [ |
|
28 | 'duplicate_of' => $this->duplicateOf, |
|
29 | ]; |
|
30 | } |
|
31 | ||
32 | public static function deserialize(array $data): MarkedAsDuplicate |
|
33 | { |
|
34 | return new static($data['place_id'], ($data['duplicate_of'])); |
|
35 | } |
|
36 | } |
|
37 |