Die einzelnen Perioden-Klassen werden erfolgreich getestet.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace TorstenHettstedt\TimekeepingApi\Repositories;
|
||||
|
||||
|
||||
use DateTime;
|
||||
use DateTimeInterface;
|
||||
use PDO;
|
||||
use TorstenHettstedt\TimekeepingApi\Models\PeriodDesignationEnum;
|
||||
|
||||
class WorkingHoursMonthlyViewRepository extends AbstractWorkingHoursViewRepository
|
||||
{
|
||||
|
||||
protected const SQL_SELECT = <<<SQL
|
||||
select
|
||||
"Monat" as "period",
|
||||
"Gesamtarbeitszeit" as "totalHours",
|
||||
"Arbeitstage" as "workingDays",
|
||||
"Überstunden" as "overtime"
|
||||
from "Arbeitszeiten - Monat"
|
||||
SQL;
|
||||
protected const SQL_WHERE = ' where "Monat" = ?';
|
||||
|
||||
protected PDO $database;
|
||||
protected PeriodDesignationEnum $periodDesignation;
|
||||
|
||||
public function __construct(PDO $database)
|
||||
{
|
||||
parent::__construct($database);
|
||||
$this->periodDesignation = PeriodDesignationEnum::MONTHLY();
|
||||
}
|
||||
|
||||
protected function buildDateFromPeriod(string $period): DateTimeInterface
|
||||
{
|
||||
return new DateTime($period . '-01');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user