| @@ 8-56 (lines=49) @@ | ||
| 5 | use CultuurNet\UDB3\Location\LocationId; |
|
| 6 | use CultuurNet\UDB3\Offer\Events\AbstractEvent; |
|
| 7 | ||
| 8 | class LocationUpdated extends AbstractEvent |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var LocationId |
|
| 12 | */ |
|
| 13 | private $locationId; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @param string $eventId |
|
| 17 | * @param LocationId $locationId |
|
| 18 | */ |
|
| 19 | public function __construct( |
|
| 20 | $eventId, |
|
| 21 | LocationId $locationId |
|
| 22 | ) { |
|
| 23 | parent::__construct($eventId); |
|
| 24 | ||
| 25 | $this->locationId = $locationId; |
|
| 26 | } |
|
| 27 | ||
| 28 | /** |
|
| 29 | * @return LocationId |
|
| 30 | */ |
|
| 31 | public function getLocationId() |
|
| 32 | { |
|
| 33 | return $this->locationId; |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @inheritdoc |
|
| 38 | */ |
|
| 39 | public function serialize() |
|
| 40 | { |
|
| 41 | return parent::serialize() + [ |
|
| 42 | 'location_id' => $this->locationId->toNative(), |
|
| 43 | ]; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @inheritdoc |
|
| 48 | */ |
|
| 49 | public static function deserialize(array $data) |
|
| 50 | { |
|
| 51 | return new static( |
|
| 52 | $data['item_id'], |
|
| 53 | new LocationId($data['location_id']) |
|
| 54 | ); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| @@ 7-51 (lines=45) @@ | ||
| 4 | ||
| 5 | use CultuurNet\UDB3\Description; |
|
| 6 | ||
| 7 | abstract class AbstractDescriptionUpdated extends AbstractEvent |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * The new description. |
|
| 11 | * @var Description |
|
| 12 | */ |
|
| 13 | protected $description; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @param string $id |
|
| 17 | * @param Description $description |
|
| 18 | */ |
|
| 19 | public function __construct($id, Description $description) |
|
| 20 | { |
|
| 21 | parent::__construct($id); |
|
| 22 | $this->description = $description; |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @return Description |
|
| 27 | */ |
|
| 28 | public function getDescription() |
|
| 29 | { |
|
| 30 | return $this->description; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * {@inheritdoc} |
|
| 35 | */ |
|
| 36 | public function serialize() |
|
| 37 | { |
|
| 38 | return parent::serialize() + array( |
|
| 39 | 'description' => $this->description->toNative(), |
|
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * @param array $data |
|
| 45 | * @return AbstractDescriptionUpdated |
|
| 46 | */ |
|
| 47 | public static function deserialize(array $data) |
|
| 48 | { |
|
| 49 | return new static($data['item_id'], new Description($data['description'])); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| @@ 7-50 (lines=44) @@ | ||
| 4 | ||
| 5 | use Broadway\Serializer\SerializableInterface; |
|
| 6 | ||
| 7 | abstract class AbstractEventWithIri extends AbstractEvent implements SerializableInterface |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @var string |
|
| 11 | */ |
|
| 12 | private $iri; |
|
| 13 | ||
| 14 | /** |
|
| 15 | * @param string $itemId |
|
| 16 | * @param string $iri |
|
| 17 | */ |
|
| 18 | public function __construct($itemId, $iri) |
|
| 19 | { |
|
| 20 | parent::__construct($itemId); |
|
| 21 | $this->iri = (string) $iri; |
|
| 22 | } |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @return string |
|
| 26 | */ |
|
| 27 | public function getIri() |
|
| 28 | { |
|
| 29 | return $this->iri; |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @return array |
|
| 34 | */ |
|
| 35 | public function serialize() |
|
| 36 | { |
|
| 37 | return parent::serialize() + array( |
|
| 38 | 'iri' => $this->iri, |
|
| 39 | ); |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @param array $data |
|
| 44 | * @return static |
|
| 45 | */ |
|
| 46 | public static function deserialize(array $data) |
|
| 47 | { |
|
| 48 | return new static($data['item_id'], $data['iri']); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 7-50 (lines=44) @@ | ||
| 4 | ||
| 5 | use CultuurNet\UDB3\Title; |
|
| 6 | ||
| 7 | abstract class AbstractTitleUpdated extends AbstractEvent |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * The new title. |
|
| 11 | * @var Title |
|
| 12 | */ |
|
| 13 | protected $title; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @param string $id |
|
| 17 | * @param Title $title |
|
| 18 | */ |
|
| 19 | public function __construct($id, Title $title) |
|
| 20 | { |
|
| 21 | parent::__construct($id); |
|
| 22 | $this->title = $title; |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @return Title |
|
| 27 | */ |
|
| 28 | public function getTitle() |
|
| 29 | { |
|
| 30 | return $this->title; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * {@inheritdoc} |
|
| 35 | */ |
|
| 36 | public function serialize() |
|
| 37 | { |
|
| 38 | return parent::serialize() + array( |
|
| 39 | 'title' => (string) $this->title, |
|
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * @return AbstractTitleUpdated |
|
| 45 | */ |
|
| 46 | public static function deserialize(array $data) |
|
| 47 | { |
|
| 48 | return new static($data['item_id'], new Title($data['title'])); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 8-57 (lines=50) @@ | ||
| 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 | * The reason why an offer is rejected, e.g.: Image and price info is missing. |
|
| 13 | */ |
|
| 14 | private $reason; |
|
| 15 | ||
| 16 | /** |
|
| 17 | * {@inheritdoc} |
|
| 18 | * |
|
| 19 | * @param StringLiteral $reason |
|
| 20 | * The reason why an offer is rejected, e.g.: Image and price info is missing. |
|
| 21 | */ |
|
| 22 | public function __construct($itemId, StringLiteral $reason) |
|
| 23 | { |
|
| 24 | parent::__construct($itemId); |
|
| 25 | $this->reason = $reason; |
|
| 26 | } |
|
| 27 | ||
| 28 | /** |
|
| 29 | * @return StringLiteral |
|
| 30 | */ |
|
| 31 | public function getReason() |
|
| 32 | { |
|
| 33 | return $this->reason; |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @return array |
|
| 38 | */ |
|
| 39 | public function serialize() |
|
| 40 | { |
|
| 41 | return parent::serialize() + array( |
|
| 42 | 'reason' => $this->reason->toNative(), |
|
| 43 | ); |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @param array $data |
|
| 48 | * @return AbstractRejected |
|
| 49 | */ |
|
| 50 | public static function deserialize(array $data) |
|
| 51 | { |
|
| 52 | return new static( |
|
| 53 | $data['item_id'], |
|
| 54 | new StringLiteral($data['reason']) |
|
| 55 | ); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 7-55 (lines=49) @@ | ||
| 4 | ||
| 5 | use CultuurNet\UDB3\Address\Address; |
|
| 6 | ||
| 7 | class AddressUpdated extends OrganizerEvent |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @var Address |
|
| 11 | */ |
|
| 12 | private $address; |
|
| 13 | ||
| 14 | /** |
|
| 15 | * @param string $organizerId |
|
| 16 | * @param Address $address |
|
| 17 | */ |
|
| 18 | public function __construct( |
|
| 19 | $organizerId, |
|
| 20 | Address $address |
|
| 21 | ) { |
|
| 22 | parent::__construct($organizerId); |
|
| 23 | $this->address = $address; |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @return Address |
|
| 28 | */ |
|
| 29 | public function getAddress() |
|
| 30 | { |
|
| 31 | return $this->address; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @return array |
|
| 36 | */ |
|
| 37 | public function serialize() |
|
| 38 | { |
|
| 39 | return parent::serialize() + [ |
|
| 40 | 'address' => $this->address->serialize(), |
|
| 41 | ]; |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @param array $data |
|
| 46 | * @return static |
|
| 47 | */ |
|
| 48 | public static function deserialize(array $data) |
|
| 49 | { |
|
| 50 | return new static( |
|
| 51 | $data['organizer_id'], |
|
| 52 | Address::deserialize($data['address']) |
|
| 53 | ); |
|
| 54 | } |
|
| 55 | } |
|
| 56 | ||
| @@ 7-56 (lines=50) @@ | ||
| 4 | ||
| 5 | use CultuurNet\UDB3\ContactPoint; |
|
| 6 | ||
| 7 | class ContactPointUpdated extends OrganizerEvent |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @var ContactPoint |
|
| 11 | */ |
|
| 12 | private $contactPoint; |
|
| 13 | ||
| 14 | /** |
|
| 15 | * @param string $organizerId |
|
| 16 | * @param ContactPoint $contactPoint |
|
| 17 | */ |
|
| 18 | public function __construct( |
|
| 19 | $organizerId, |
|
| 20 | ContactPoint $contactPoint |
|
| 21 | ) { |
|
| 22 | parent::__construct($organizerId); |
|
| 23 | $this->contactPoint = $contactPoint; |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @return ContactPoint |
|
| 28 | */ |
|
| 29 | public function getContactPoint() |
|
| 30 | { |
|
| 31 | return $this->contactPoint; |
|
| 32 | } |
|
| 33 | ||
| 34 | ||
| 35 | /** |
|
| 36 | * @return array |
|
| 37 | */ |
|
| 38 | public function serialize() |
|
| 39 | { |
|
| 40 | return parent::serialize() + [ |
|
| 41 | 'contactPoint' => $this->contactPoint->serialize(), |
|
| 42 | ]; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @param array $data |
|
| 47 | * @return static |
|
| 48 | */ |
|
| 49 | public static function deserialize(array $data) |
|
| 50 | { |
|
| 51 | return new static( |
|
| 52 | $data['organizer_id'], |
|
| 53 | ContactPoint::deserialize($data['contactPoint']) |
|
| 54 | ); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| @@ 7-56 (lines=50) @@ | ||
| 4 | ||
| 5 | use CultuurNet\UDB3\Title; |
|
| 6 | ||
| 7 | class TitleUpdated extends OrganizerEvent |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @var Title |
|
| 11 | */ |
|
| 12 | private $title; |
|
| 13 | ||
| 14 | /** |
|
| 15 | * TitleUpdated constructor. |
|
| 16 | * @param string $organizerId |
|
| 17 | * @param Title $title |
|
| 18 | */ |
|
| 19 | public function __construct( |
|
| 20 | $organizerId, |
|
| 21 | Title $title |
|
| 22 | ) { |
|
| 23 | parent::__construct($organizerId); |
|
| 24 | $this->title = $title; |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @return Title |
|
| 29 | */ |
|
| 30 | public function getTitle() |
|
| 31 | { |
|
| 32 | return $this->title; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @return array |
|
| 37 | */ |
|
| 38 | public function serialize() |
|
| 39 | { |
|
| 40 | return parent::serialize() + [ |
|
| 41 | 'title' => $this->getTitle()->toNative(), |
|
| 42 | ]; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @param array $data |
|
| 47 | * @return static |
|
| 48 | */ |
|
| 49 | public static function deserialize(array $data) |
|
| 50 | { |
|
| 51 | return new static( |
|
| 52 | $data['organizer_id'], |
|
| 53 | new Title($data['title']) |
|
| 54 | ); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| @@ 7-56 (lines=50) @@ | ||
| 4 | ||
| 5 | use ValueObjects\Web\Url; |
|
| 6 | ||
| 7 | class WebsiteUpdated extends OrganizerEvent |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @var Url |
|
| 11 | */ |
|
| 12 | private $website; |
|
| 13 | ||
| 14 | /** |
|
| 15 | * WebsiteUpdated constructor. |
|
| 16 | * @param string $organizerId |
|
| 17 | * @param Url $website |
|
| 18 | */ |
|
| 19 | public function __construct( |
|
| 20 | $organizerId, |
|
| 21 | Url $website |
|
| 22 | ) { |
|
| 23 | parent::__construct($organizerId); |
|
| 24 | $this->website = $website; |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @return Url |
|
| 29 | */ |
|
| 30 | public function getWebsite() |
|
| 31 | { |
|
| 32 | return $this->website; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @return array |
|
| 37 | */ |
|
| 38 | public function serialize() |
|
| 39 | { |
|
| 40 | return parent::serialize() + [ |
|
| 41 | 'website' => (string) $this->getWebsite(), |
|
| 42 | ]; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @param array $data |
|
| 47 | * @return static |
|
| 48 | */ |
|
| 49 | public static function deserialize(array $data) |
|
| 50 | { |
|
| 51 | return new static( |
|
| 52 | $data['organizer_id'], |
|
| 53 | Url::fromNative($data['website']) |
|
| 54 | ); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| @@ 8-51 (lines=44) @@ | ||
| 5 | use CultuurNet\UDB3\Role\ValueObjects\Permission; |
|
| 6 | use ValueObjects\Identity\UUID; |
|
| 7 | ||
| 8 | class AbstractPermissionEvent extends AbstractEvent |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var Permission |
|
| 12 | */ |
|
| 13 | private $permission; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * AbstractPermissionEvent constructor. |
|
| 17 | * @param UUID $uuid |
|
| 18 | * @param Permission $permission |
|
| 19 | */ |
|
| 20 | public function __construct(UUID $uuid, Permission $permission) |
|
| 21 | { |
|
| 22 | parent::__construct($uuid); |
|
| 23 | $this->permission = $permission; |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @return Permission |
|
| 28 | */ |
|
| 29 | public function getPermission() |
|
| 30 | { |
|
| 31 | return $this->permission; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @inheritdoc |
|
| 36 | */ |
|
| 37 | public static function deserialize(array $data) |
|
| 38 | { |
|
| 39 | return new static(new UUID($data['uuid']), Permission::fromNative($data['permission'])); |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @inheritdoc |
|
| 44 | */ |
|
| 45 | public function serialize() |
|
| 46 | { |
|
| 47 | return parent::serialize() + array( |
|
| 48 | 'permission' => $this->permission->toNative(), |
|
| 49 | ); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| @@ 8-54 (lines=47) @@ | ||
| 5 | use ValueObjects\Identity\UUID; |
|
| 6 | use ValueObjects\StringLiteral\StringLiteral; |
|
| 7 | ||
| 8 | class RoleCreated extends AbstractEvent |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var StringLiteral |
|
| 12 | */ |
|
| 13 | private $name; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * RoleCreated constructor. |
|
| 17 | * @param UUID $uuid |
|
| 18 | * @param StringLiteral $name |
|
| 19 | */ |
|
| 20 | public function __construct(UUID $uuid, StringLiteral $name) |
|
| 21 | { |
|
| 22 | parent::__construct($uuid); |
|
| 23 | $this->name = $name; |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @return StringLiteral |
|
| 28 | */ |
|
| 29 | public function getName() |
|
| 30 | { |
|
| 31 | return $this->name; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @inheritdoc |
|
| 36 | */ |
|
| 37 | public static function deserialize(array $data) |
|
| 38 | { |
|
| 39 | return new static( |
|
| 40 | new UUID($data['uuid']), |
|
| 41 | new StringLiteral($data['name']) |
|
| 42 | ); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @inheritdoc |
|
| 47 | */ |
|
| 48 | public function serialize() |
|
| 49 | { |
|
| 50 | return parent::serialize() + [ |
|
| 51 | 'name' => $this->name->toNative(), |
|
| 52 | ]; |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||
| @@ 8-54 (lines=47) @@ | ||
| 5 | use ValueObjects\Identity\UUID; |
|
| 6 | use ValueObjects\StringLiteral\StringLiteral; |
|
| 7 | ||
| 8 | class RoleRenamed extends AbstractEvent |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var StringLiteral |
|
| 12 | */ |
|
| 13 | private $name; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * RoleCreated constructor. |
|
| 17 | * @param UUID $uuid |
|
| 18 | * @param StringLiteral $name |
|
| 19 | */ |
|
| 20 | public function __construct(UUID $uuid, StringLiteral $name) |
|
| 21 | { |
|
| 22 | parent::__construct($uuid); |
|
| 23 | $this->name = $name; |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @return StringLiteral |
|
| 28 | */ |
|
| 29 | public function getName() |
|
| 30 | { |
|
| 31 | return $this->name; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @inheritdoc |
|
| 36 | */ |
|
| 37 | public static function deserialize(array $data) |
|
| 38 | { |
|
| 39 | return new static( |
|
| 40 | new UUID($data['uuid']), |
|
| 41 | new StringLiteral($data['name']) |
|
| 42 | ); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @inheritdoc |
|
| 47 | */ |
|
| 48 | public function serialize() |
|
| 49 | { |
|
| 50 | return parent::serialize() + [ |
|
| 51 | 'name' => $this->name->toNative(), |
|
| 52 | ]; |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||
| @@ 8-55 (lines=48) @@ | ||
| 5 | use CultuurNet\UDB3\ValueObject\SapiVersion; |
|
| 6 | use ValueObjects\Identity\UUID; |
|
| 7 | ||
| 8 | class ConstraintRemoved extends AbstractEvent |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var SapiVersion |
|
| 12 | */ |
|
| 13 | private $sapiVersion; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @param UUID $uuid |
|
| 17 | * @param SapiVersion $sapiVersion |
|
| 18 | */ |
|
| 19 | public function __construct( |
|
| 20 | UUID $uuid, |
|
| 21 | SapiVersion $sapiVersion |
|
| 22 | ) { |
|
| 23 | parent::__construct($uuid); |
|
| 24 | $this->sapiVersion = $sapiVersion; |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @return SapiVersion |
|
| 29 | */ |
|
| 30 | public function getSapiVersion(): SapiVersion |
|
| 31 | { |
|
| 32 | return $this->sapiVersion; |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @inheritdoc |
|
| 37 | */ |
|
| 38 | public static function deserialize(array $data) |
|
| 39 | { |
|
| 40 | return new static( |
|
| 41 | new UUID($data['uuid']), |
|
| 42 | SapiVersion::fromNative($data['sapiVersion']) |
|
| 43 | ); |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @inheritdoc |
|
| 48 | */ |
|
| 49 | public function serialize() |
|
| 50 | { |
|
| 51 | return parent::serialize() + array( |
|
| 52 | 'sapiVersion' => $this->sapiVersion->toNative(), |
|
| 53 | ); |
|
| 54 | } |
|
| 55 | } |
|
| 56 | ||