Skip to content

Commit

Permalink
ability to mark a pavilion as private
Browse files Browse the repository at this point in the history
  • Loading branch information
tharangakothalawala committed Apr 9, 2020
1 parent 5706ec2 commit 9084f77
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/pavilion-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

Expand Down
30 changes: 30 additions & 0 deletions src/Service/Model/Pavilion.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand All @@ -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())) {
Expand All @@ -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;
}
Expand Down

0 comments on commit 9084f77

Please sign in to comment.