do not allow to stop already stopped timesheets (#289)

This commit is contained in:
Kevin Papst
2018-09-01 13:00:30 +02:00
committed by GitHub
parent b1546c0568
commit 62f91f4d38
15 changed files with 294 additions and 68 deletions

View File

@@ -20,6 +20,7 @@ class BaseQuery
public const DEFAULT_PAGESIZE = 25;
public const DEFAULT_PAGE = 1;
public const RESULT_TYPE_OBJECTS = 'Objects';
public const RESULT_TYPE_PAGER = 'PagerFanta';
public const RESULT_TYPE_QUERYBUILDER = 'QueryBuilder';
@@ -141,13 +142,18 @@ class BaseQuery
/**
* @param string $resultType
* @return $this
* @throws \InvalidArgumentException
*/
public function setResultType($resultType)
public function setResultType(string $resultType)
{
if (in_array($resultType, [self::RESULT_TYPE_PAGER, self::RESULT_TYPE_QUERYBUILDER])) {
$this->resultType = $resultType;
$allowed = [self::RESULT_TYPE_PAGER, self::RESULT_TYPE_QUERYBUILDER, self::RESULT_TYPE_OBJECTS];
if (!in_array($resultType, $allowed)) {
throw new \InvalidArgumentException('Unsupported query result type');
}
$this->resultType = $resultType;
return $this;
}