| @@ 7-36 (lines=30) @@ | ||
| 4 | ||
| 5 | use CultuurNet\UDB3\Description; |
|
| 6 | ||
| 7 | abstract class AbstractDescriptionUpdated extends AbstractEvent |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @var Description |
|
| 11 | */ |
|
| 12 | protected $description; |
|
| 13 | ||
| 14 | final public function __construct(string $id, Description $description) |
|
| 15 | { |
|
| 16 | parent::__construct($id); |
|
| 17 | $this->description = $description; |
|
| 18 | } |
|
| 19 | ||
| 20 | public function getDescription(): Description |
|
| 21 | { |
|
| 22 | return $this->description; |
|
| 23 | } |
|
| 24 | ||
| 25 | public function serialize(): array |
|
| 26 | { |
|
| 27 | return parent::serialize() + array( |
|
| 28 | 'description' => $this->description->toNative(), |
|
| 29 | ); |
|
| 30 | } |
|
| 31 | ||
| 32 | public static function deserialize(array $data): AbstractDescriptionUpdated |
|
| 33 | { |
|
| 34 | return new static($data['item_id'], new Description($data['description'])); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | ||
| @@ 7-36 (lines=30) @@ | ||
| 4 | ||
| 5 | use CultuurNet\UDB3\Title; |
|
| 6 | ||
| 7 | abstract class AbstractTitleUpdated extends AbstractEvent |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @var Title |
|
| 11 | */ |
|
| 12 | protected $title; |
|
| 13 | ||
| 14 | final public function __construct(string $id, Title $title) |
|
| 15 | { |
|
| 16 | parent::__construct($id); |
|
| 17 | $this->title = $title; |
|
| 18 | } |
|
| 19 | ||
| 20 | public function getTitle(): Title |
|
| 21 | { |
|
| 22 | return $this->title; |
|
| 23 | } |
|
| 24 | ||
| 25 | public function serialize(): array |
|
| 26 | { |
|
| 27 | return parent::serialize() + array( |
|
| 28 | 'title' => (string) $this->title, |
|
| 29 | ); |
|
| 30 | } |
|
| 31 | ||
| 32 | public static function deserialize(array $data): AbstractTitleUpdated |
|
| 33 | { |
|
| 34 | return new static($data['item_id'], new Title($data['title'])); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | ||
| @@ 8-40 (lines=33) @@ | ||
| 5 | use CultuurNet\UDB3\Offer\Events\AbstractEvent; |
|
| 6 | use ValueObjects\StringLiteral\StringLiteral; |
|
| 7 | ||
| 8 | abstract class AbstractRejected extends AbstractEvent |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var StringLiteral |
|
| 12 | */ |
|
| 13 | private $reason; |
|
| 14 | ||
| 15 | final public function __construct(string $itemId, StringLiteral $reason) |
|
| 16 | { |
|
| 17 | parent::__construct($itemId); |
|
| 18 | $this->reason = $reason; |
|
| 19 | } |
|
| 20 | ||
| 21 | public function getReason(): StringLiteral |
|
| 22 | { |
|
| 23 | return $this->reason; |
|
| 24 | } |
|
| 25 | ||
| 26 | public function serialize(): array |
|
| 27 | { |
|
| 28 | return parent::serialize() + array( |
|
| 29 | 'reason' => $this->reason->toNative(), |
|
| 30 | ); |
|
| 31 | } |
|
| 32 | ||
| 33 | public static function deserialize(array $data): AbstractRejected |
|
| 34 | { |
|
| 35 | return new static( |
|
| 36 | $data['item_id'], |
|
| 37 | new StringLiteral($data['reason']) |
|
| 38 | ); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| @@ 7-41 (lines=35) @@ | ||
| 4 | ||
| 5 | use CultuurNet\UDB3\ContactPoint; |
|
| 6 | ||
| 7 | final class ContactPointUpdated extends OrganizerEvent |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @var ContactPoint |
|
| 11 | */ |
|
| 12 | private $contactPoint; |
|
| 13 | ||
| 14 | public function __construct( |
|
| 15 | string $organizerId, |
|
| 16 | ContactPoint $contactPoint |
|
| 17 | ) { |
|
| 18 | parent::__construct($organizerId); |
|
| 19 | $this->contactPoint = $contactPoint; |
|
| 20 | } |
|
| 21 | ||
| 22 | public function getContactPoint(): ContactPoint |
|
| 23 | { |
|
| 24 | return $this->contactPoint; |
|
| 25 | } |
|
| 26 | ||
| 27 | public function serialize(): array |
|
| 28 | { |
|
| 29 | return parent::serialize() + [ |
|
| 30 | 'contactPoint' => $this->contactPoint->serialize(), |
|
| 31 | ]; |
|
| 32 | } |
|
| 33 | ||
| 34 | public static function deserialize(array $data): ContactPointUpdated |
|
| 35 | { |
|
| 36 | return new static( |
|
| 37 | $data['organizer_id'], |
|
| 38 | ContactPoint::deserialize($data['contactPoint']) |
|
| 39 | ); |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||
| @@ 7-41 (lines=35) @@ | ||
| 4 | ||
| 5 | use CultuurNet\UDB3\Title; |
|
| 6 | ||
| 7 | final class TitleUpdated extends OrganizerEvent |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @var Title |
|
| 11 | */ |
|
| 12 | private $title; |
|
| 13 | ||
| 14 | public function __construct( |
|
| 15 | string $organizerId, |
|
| 16 | Title $title |
|
| 17 | ) { |
|
| 18 | parent::__construct($organizerId); |
|
| 19 | $this->title = $title; |
|
| 20 | } |
|
| 21 | ||
| 22 | public function getTitle(): Title |
|
| 23 | { |
|
| 24 | return $this->title; |
|
| 25 | } |
|
| 26 | ||
| 27 | public function serialize(): array |
|
| 28 | { |
|
| 29 | return parent::serialize() + [ |
|
| 30 | 'title' => $this->getTitle()->toNative(), |
|
| 31 | ]; |
|
| 32 | } |
|
| 33 | ||
| 34 | public static function deserialize(array $data): TitleUpdated |
|
| 35 | { |
|
| 36 | return new static( |
|
| 37 | $data['organizer_id'], |
|
| 38 | new Title($data['title']) |
|
| 39 | ); |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||
| @@ 7-41 (lines=35) @@ | ||
| 4 | ||
| 5 | use ValueObjects\Web\Url; |
|
| 6 | ||
| 7 | final class WebsiteUpdated extends OrganizerEvent |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @var Url |
|
| 11 | */ |
|
| 12 | private $website; |
|
| 13 | ||
| 14 | public function __construct( |
|
| 15 | string $organizerId, |
|
| 16 | Url $website |
|
| 17 | ) { |
|
| 18 | parent::__construct($organizerId); |
|
| 19 | $this->website = $website; |
|
| 20 | } |
|
| 21 | ||
| 22 | public function getWebsite(): Url |
|
| 23 | { |
|
| 24 | return $this->website; |
|
| 25 | } |
|
| 26 | ||
| 27 | public function serialize(): array |
|
| 28 | { |
|
| 29 | return parent::serialize() + [ |
|
| 30 | 'website' => (string) $this->getWebsite(), |
|
| 31 | ]; |
|
| 32 | } |
|
| 33 | ||
| 34 | public static function deserialize(array $data): WebsiteUpdated |
|
| 35 | { |
|
| 36 | return new static( |
|
| 37 | $data['organizer_id'], |
|
| 38 | Url::fromNative($data['website']) |
|
| 39 | ); |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||
| @@ 8-37 (lines=30) @@ | ||
| 5 | use CultuurNet\UDB3\Role\ValueObjects\Permission; |
|
| 6 | use ValueObjects\Identity\UUID; |
|
| 7 | ||
| 8 | abstract class AbstractPermissionEvent extends AbstractEvent |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var Permission |
|
| 12 | */ |
|
| 13 | private $permission; |
|
| 14 | ||
| 15 | final public function __construct(UUID $uuid, Permission $permission) |
|
| 16 | { |
|
| 17 | parent::__construct($uuid); |
|
| 18 | $this->permission = $permission; |
|
| 19 | } |
|
| 20 | ||
| 21 | public function getPermission(): Permission |
|
| 22 | { |
|
| 23 | return $this->permission; |
|
| 24 | } |
|
| 25 | ||
| 26 | public static function deserialize(array $data): AbstractPermissionEvent |
|
| 27 | { |
|
| 28 | return new static(new UUID($data['uuid']), Permission::fromNative($data['permission'])); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function serialize(): array |
|
| 32 | { |
|
| 33 | return parent::serialize() + array( |
|
| 34 | 'permission' => $this->permission->toNative(), |
|
| 35 | ); |
|
| 36 | } |
|
| 37 | } |
|
| 38 | ||
| @@ 8-42 (lines=35) @@ | ||
| 5 | use CultuurNet\UDB3\ValueObject\SapiVersion; |
|
| 6 | use ValueObjects\Identity\UUID; |
|
| 7 | ||
| 8 | final class ConstraintRemoved extends AbstractEvent |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var SapiVersion |
|
| 12 | */ |
|
| 13 | private $sapiVersion; |
|
| 14 | ||
| 15 | final public function __construct( |
|
| 16 | UUID $uuid, |
|
| 17 | SapiVersion $sapiVersion |
|
| 18 | ) { |
|
| 19 | parent::__construct($uuid); |
|
| 20 | $this->sapiVersion = $sapiVersion; |
|
| 21 | } |
|
| 22 | ||
| 23 | public function getSapiVersion(): SapiVersion |
|
| 24 | { |
|
| 25 | return $this->sapiVersion; |
|
| 26 | } |
|
| 27 | ||
| 28 | public static function deserialize(array $data): ConstraintRemoved |
|
| 29 | { |
|
| 30 | return new static( |
|
| 31 | new UUID($data['uuid']), |
|
| 32 | SapiVersion::fromNative($data['sapiVersion']) |
|
| 33 | ); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function serialize(): array |
|
| 37 | { |
|
| 38 | return parent::serialize() + array( |
|
| 39 | 'sapiVersion' => $this->sapiVersion->toNative(), |
|
| 40 | ); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| @@ 8-40 (lines=33) @@ | ||
| 5 | use ValueObjects\Identity\UUID; |
|
| 6 | use ValueObjects\StringLiteral\StringLiteral; |
|
| 7 | ||
| 8 | final class RoleCreated extends AbstractEvent |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var StringLiteral |
|
| 12 | */ |
|
| 13 | private $name; |
|
| 14 | ||
| 15 | final public function __construct(UUID $uuid, StringLiteral $name) |
|
| 16 | { |
|
| 17 | parent::__construct($uuid); |
|
| 18 | $this->name = $name; |
|
| 19 | } |
|
| 20 | ||
| 21 | public function getName(): StringLiteral |
|
| 22 | { |
|
| 23 | return $this->name; |
|
| 24 | } |
|
| 25 | ||
| 26 | public static function deserialize(array $data): RoleCreated |
|
| 27 | { |
|
| 28 | return new static( |
|
| 29 | new UUID($data['uuid']), |
|
| 30 | new StringLiteral($data['name']) |
|
| 31 | ); |
|
| 32 | } |
|
| 33 | ||
| 34 | public function serialize(): array |
|
| 35 | { |
|
| 36 | return parent::serialize() + [ |
|
| 37 | 'name' => $this->name->toNative(), |
|
| 38 | ]; |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| @@ 8-40 (lines=33) @@ | ||
| 5 | use ValueObjects\Identity\UUID; |
|
| 6 | use ValueObjects\StringLiteral\StringLiteral; |
|
| 7 | ||
| 8 | final class RoleRenamed extends AbstractEvent |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var StringLiteral |
|
| 12 | */ |
|
| 13 | private $name; |
|
| 14 | ||
| 15 | final public function __construct(UUID $uuid, StringLiteral $name) |
|
| 16 | { |
|
| 17 | parent::__construct($uuid); |
|
| 18 | $this->name = $name; |
|
| 19 | } |
|
| 20 | ||
| 21 | public function getName(): StringLiteral |
|
| 22 | { |
|
| 23 | return $this->name; |
|
| 24 | } |
|
| 25 | ||
| 26 | public static function deserialize(array $data): RoleRenamed |
|
| 27 | { |
|
| 28 | return new static( |
|
| 29 | new UUID($data['uuid']), |
|
| 30 | new StringLiteral($data['name']) |
|
| 31 | ); |
|
| 32 | } |
|
| 33 | ||
| 34 | public function serialize(): array |
|
| 35 | { |
|
| 36 | return parent::serialize() + [ |
|
| 37 | 'name' => $this->name->toNative(), |
|
| 38 | ]; |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||