Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main organizers #70

Merged
merged 20 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/SearchClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public function searchOffers(SearchQueryInterface $searchQuery): PagedCollection
return $this->search($searchQuery, 'offers');
}

public function searchOrganizers(SearchQueryInterface $searchQuery): PagedCollection
{
return $this->search($searchQuery, 'organizers');
}

private function search(SearchQueryInterface $searchQuery, $type): PagedCollection
{
$options = [
Expand Down
2 changes: 2 additions & 0 deletions src/SearchClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ public function searchEvents(SearchQueryInterface $searchQuery): PagedCollection
public function searchPlaces(SearchQueryInterface $searchQuery): PagedCollection;

public function searchOffers(SearchQueryInterface $searchQuery): PagedCollection;

public function searchOrganizers(SearchQueryInterface $searchQuery): PagedCollection;
}
3 changes: 3 additions & 0 deletions src/Serializer/Handler/CollectionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use CultuurNet\SearchV3\Serializer\Serializer;
use CultuurNet\SearchV3\ValueObjects\Collection;
use CultuurNet\SearchV3\ValueObjects\Event;
use CultuurNet\SearchV3\ValueObjects\Organizer;
use CultuurNet\SearchV3\ValueObjects\Place;
use JMS\Serializer\Context;
use JMS\Serializer\GraphNavigator;
Expand All @@ -18,11 +19,13 @@ final class CollectionHandler implements SubscribingHandlerInterface
private $contextMapping = [
'/contexts/event' => Event::class,
'/contexts/place' => Place::class,
'/contexts/organizer' => Organizer::class,
];

private $typeMapping = [
'Event' => Event::class,
'Place' => Place::class,
'Organizer' => Organizer::class,
];

public static function getSubscribingMethods(): array
Expand Down
8 changes: 4 additions & 4 deletions src/ValueObjects/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(
$this->streetAddress = $streetAddress;
}

public function getAddressCountry(): string
public function getAddressCountry(): ?string
{
return $this->addressCountry;
}
Expand All @@ -48,7 +48,7 @@ public function setAddressCountry(string $addressCountry): void
$this->addressCountry = $addressCountry;
}

public function getAddressLocality(): string
public function getAddressLocality(): ?string
{
return $this->addressLocality;
}
Expand All @@ -58,7 +58,7 @@ public function setAddressLocality(string $addressLocality): void
$this->addressLocality = $addressLocality;
}

public function getPostalCode(): string
public function getPostalCode(): ?string
{
return $this->postalCode;
}
Expand All @@ -68,7 +68,7 @@ public function setPostalCode(string $postalCode): void
$this->postalCode = $postalCode;
}

public function getStreetAddress(): string
public function getStreetAddress(): ?string
{
return $this->streetAddress;
}
Expand Down
15 changes: 15 additions & 0 deletions src/ValueObjects/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,19 @@ public function setOnlineUrl(?string $onlineUrl): void
{
$this->onlineUrl = $onlineUrl;
}

public function isAttendanceModeOnline(): bool
{
return null !== $this->getAttendanceMode() && $this->getAttendanceMode() === 'online';
}

public function isAttendanceModeOffline(): bool
{
return null !== $this->getAttendanceMode() && $this->getAttendanceMode() === 'offline';
}

public function isAttendanceModeMixed(): bool
{
return null !== $this->getAttendanceMode() && $this->getAttendanceMode() === 'mixed';
}
}
4 changes: 2 additions & 2 deletions src/ValueObjects/GeoPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ final class GeoPoint
{
/**
* @var float|null
* @Type("string")
* @Type("float")
*/
private $latitude;

/**
* @var float|null
* @Type("string")
* @Type("float")
*/
private $longitude;

Expand Down
40 changes: 40 additions & 0 deletions src/ValueObjects/MediaObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ final class MediaObject
*/
private $id;

/**
* @var string|null
* @Type("string")
* @SerializedName("id")
*/
private $uuid;

/**
* @var string|null
* @Type("string")
Expand All @@ -40,6 +47,18 @@ final class MediaObject
*/
private $copyrightHolder;

/**
* @var string|null
* @Type("string")
*/
private $inLanguage;

/**
* @var string|null
* @Type("string")
*/
private $language;

public function getId(): string
{
return $this->id;
Expand All @@ -50,6 +69,16 @@ public function setId(string $id): void
$this->id = $id;
}

public function getUuid(): ?string
{
return $this->uuid;
}

public function setUuid(?string $uuid): void
{
$this->uuid = $uuid;
}

public function getContentUrl(): ?string
{
return $this->contentUrl;
Expand Down Expand Up @@ -89,4 +118,15 @@ public function setCopyrightHolder(string $copyrightHolder): void
{
$this->copyrightHolder = $copyrightHolder;
}

public function setLanguage(string $language): void
{
$this->language = $language;
$this->inLanguage = $language;
}

public function getLanguage(): ?string
{
return $this->language ?? $this->inLanguage;
}
}
Loading