Update Summit API

* now summit list return only the summit marked as
available for api. that allows us to control which
summits will be public availbable ( instead of everything
as formerly)
* also current summit query was updated to check the
 api availability flag.

Change-Id: Ib344d7fe899a5802c195326fbbb5028f4807ebc0
This commit is contained in:
Sebastian Marcet
2016-12-05 16:38:59 -03:00
parent c92167b0b3
commit a14a4e8ec9
7 changed files with 91 additions and 12 deletions

View File

@@ -20,4 +20,9 @@ interface ISummitRepository extends IBaseRepository
* @return Summit
*/
public function getCurrent();
/**
* @return Summit[]
*/
public function getAvailables();
}

View File

@@ -169,6 +169,28 @@ class Summit extends SilverstripeBaseModel
*/
private $active;
/**
* @return boolean
*/
public function isAvailableOnApi()
{
return $this->available_on_api;
}
/**
* @param boolean $available_on_api
*/
public function setAvailableOnApi($available_on_api)
{
$this->available_on_api = $available_on_api;
}
/**
* @ORM\Column(name="AvailableOnApi", type="boolean")
* @var bool
*/
private $available_on_api;
/**
* @ORM\Column(name="ExternalEventId", type="string")
* @var string
@@ -186,7 +208,12 @@ class Summit extends SilverstripeBaseModel
*/
public function getType()
{
return $this->type;
try {
return $this->type;
}
catch (\Exception $ex){
return null;
}
}
/**
@@ -209,6 +236,13 @@ class Summit extends SilverstripeBaseModel
}
}
/**
* @return bool
*/
public function hasType(){
return $this->getTypeId() > 0;
}
/**
* @ORM\ManyToOne(targetEntity="SummitType", fetch="EXTRA_LAZY")
* @ORM\JoinColumn(name="TypeID", referencedColumnName="ID")