SurveyService - allow to verify if survey with given ID exists and if is active

This commit is contained in:
Meritoo
2017-09-29 23:55:56 +02:00
parent 5243294bd5
commit 54bd0ca114
2 changed files with 58 additions and 18 deletions

View File

@@ -106,12 +106,14 @@ class SurveyService
/**
* Returns information if survey with given ID exists
*
* @param int $surveyId ID of survey to verify
* @param int $surveyId ID of survey to verify
* @param bool $shouldBeActive (optional) If is set to true, survey should be active. If it's not, it shouldn't
* be returned, even if exists. Otherwise - it doesn't matter.
* @return bool
*/
public function isExistingSurvey($surveyId)
public function isExistingSurvey($surveyId, $shouldBeActive = false)
{
$allSurveys = $this->getAllSurveys();
$allSurveys = $this->getAllSurveys($shouldBeActive);
/*
* No surveys?