From 9084f77043dfea52dd35d0b45e5280acdb94f8a0 Mon Sep 17 00:00:00 2001 From: Tharanga Kothalawala Date: Thu, 9 Apr 2020 22:28:12 +0100 Subject: [PATCH] ability to mark a pavilion as private --- examples/pavilion-service.php | 6 ++++-- src/Service/Model/Pavilion.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/examples/pavilion-service.php b/examples/pavilion-service.php index 0f47ccf..b5ad952 100755 --- a/examples/pavilion-service.php +++ b/examples/pavilion-service.php @@ -36,7 +36,8 @@ ->setLatitude(51.507351) ->setLongitude(-0.127758) ->setTerritory('test-territory') - ->setIsVisible(false); + ->setIsVisible(false) + ->setIsPrivate(true); $result = $service->createPavilion($pavilion); $newPavilionId = $result['pavilion']['id']; var_dump($result); @@ -45,7 +46,8 @@ $pavilion->setName('name [edited] at : ' . time()) ->setDescription('description [edited] at : ' . time()) ->setAddress('address [edited] at : ' . time()) - ->setIsVisible(true); + ->setIsVisible(true) + ->setIsPrivate(false); $result = $service->editPavilion($newPavilionId, $pavilion); var_dump($result); diff --git a/src/Service/Model/Pavilion.php b/src/Service/Model/Pavilion.php index 6ab78b0..2f9f0db 100644 --- a/src/Service/Model/Pavilion.php +++ b/src/Service/Model/Pavilion.php @@ -65,6 +65,13 @@ final class Pavilion */ private $isVisible; + /** + * @var bool flag to make this new pavilion a private. Even if the visibility is set to true, marking a pavilion as + * private will prevent it from appearing on user interfaces. + * Ex: https://hubculture.com/pavilions + */ + private $isPrivate; + /** * @return int */ @@ -255,6 +262,25 @@ public function setIsVisible($isVisible) return $this; } + /** + * @return bool + */ + public function isPrivate() + { + return $this->isPrivate; + } + + /** + * @param bool $isPrivate + * + * @return Pavilion + */ + public function setIsPrivate($isPrivate) + { + $this->isPrivate = $isPrivate; + return $this; + } + /** * @return array */ @@ -270,6 +296,7 @@ public function toArray() 'url' => $this->getPavilionRelativeUrl(), 'territory' => $this->getTerritory(), 'visible' => $this->isVisible(), + 'is_private' => $this->isPrivate(), ); if (!is_null($this->getId())) { @@ -278,6 +305,9 @@ public function toArray() if (!is_null($this->isVisible())) { $data['visible'] = ($this->isVisible()) ? 1 : 0; } + if (!is_null($this->isPrivate())) { + $data['is_private'] = ($this->isPrivate()) ? 1 : 0; + } return $data; }