Korrigiere PHP-Hinweise
This commit is contained in:
@@ -20,6 +20,13 @@ use TorstenHettstedt\TimekeepingApi\Models\WorkingHours;
|
||||
*/
|
||||
class WorkingHoursRepository implements RepositoryReaderInterface, RepositoryWriterInterface
|
||||
{
|
||||
protected const string SQL_SELECT = <<<'SQL'
|
||||
select
|
||||
"Datum" as "workingDay",
|
||||
"Arbeitszeit" as "workingTime"
|
||||
from public."Arbeitszeiten"
|
||||
SQL;
|
||||
|
||||
|
||||
public function __construct(protected PDO $database)
|
||||
{
|
||||
@@ -88,7 +95,7 @@ class WorkingHoursRepository implements RepositoryReaderInterface, RepositoryWri
|
||||
|
||||
protected function buildFindFilteredStatement(?string $start, ?string $end): ?PDOStatement
|
||||
{
|
||||
$query = 'select "Datum" as "workingDay", "Arbeitszeit" as "workingTime" from public."Arbeitszeiten" ';
|
||||
$query = static::SQL_SELECT . ' ';
|
||||
$query .= $this->buildFilterString($start, $end);
|
||||
$query .= 'order by "Datum"';
|
||||
$stmt = $this->database->prepare($query);
|
||||
@@ -113,9 +120,7 @@ class WorkingHoursRepository implements RepositoryReaderInterface, RepositoryWri
|
||||
*/
|
||||
public function findByKey(mixed $primary_key): WorkingHours
|
||||
{
|
||||
$stmt = $this->database->prepare(
|
||||
'select "Datum" as "workingDay", "Arbeitszeit" as "workingTime" from public."Arbeitszeiten" where "Datum" = ?'
|
||||
);
|
||||
$stmt = $this->database->prepare(static::SQL_SELECT . ' where "Datum" = ?');
|
||||
$stmt->bindParam(1, $primary_key);
|
||||
$stmt->execute();
|
||||
$row = $stmt->fetch();
|
||||
|
||||
Reference in New Issue
Block a user