API endpoint for Timesheet entries (#332)

This commit is contained in:
Kevin Papst
2018-11-18 19:43:58 +01:00
committed by GitHub
parent 8cb52e22b1
commit b1c06eed7b
35 changed files with 1073 additions and 118 deletions

View File

@@ -43,9 +43,40 @@ class TimesheetFixtures extends Fixture
* @var string
*/
protected $startDate = '2018-04-01';
/**
* @var bool
*/
protected $fixedRate = false;
/**
* @var bool
*/
protected $hourlyRate = false;
/**
* @param bool $fixedRate
* @return TimesheetFixtures
*/
public function setFixedRate(bool $fixedRate)
{
$this->fixedRate = $fixedRate;
return $this;
}
/**
* @param bool $hourlyRate
* @return TimesheetFixtures
*/
public function setHourlyRate(bool $hourlyRate)
{
$this->hourlyRate = $hourlyRate;
return $this;
}
/**
* @param string|\DateTime $date
* @return TimesheetFixtures
*/
public function setStartDate($date)
{
@@ -53,6 +84,8 @@ class TimesheetFixtures extends Fixture
$date = $date->format('Y-m-d');
}
$this->startDate = $date;
return $this;
}
/**
@@ -232,6 +265,14 @@ class TimesheetFixtures extends Fixture
->setRate(round(($duration / 3600) * $rate))
->setBegin($start);
if ($this->fixedRate) {
$entry->setFixedRate(rand(10, 100));
}
if ($this->hourlyRate) {
$entry->setHourlyRate($rate);
}
if ($setEndDate) {
$entry
->setEnd($end)