added API for handling work contract times (#4016)

This commit is contained in:
Kevin Papst
2023-05-13 01:24:15 +02:00
committed by GitHub
parent 4b2a3669e6
commit 43bd7bf1ab
53 changed files with 2684 additions and 27 deletions

View File

@@ -0,0 +1,48 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Event;
use App\WorkingTime\Model\Year;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Triggered for work-contract status pages, to add additional content boxes.
*
* @see https://symfony.com/doc/current/templates.html#embedding-controllers
*/
final class WorkContractDetailControllerEvent extends Event
{
/**
* @var array<string>
*/
private array $controller = [];
public function __construct(private Year $year)
{
}
public function getYear(): Year
{
return $this->year;
}
public function addController(string $controller): void
{
$this->controller[] = $controller;
}
/**
* @return string[]
*/
public function getController(): array
{
return $this->controller;
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Event;
use App\WorkingTime\Model\Year;
use App\WorkingTime\Model\YearPerUserSummary;
use App\WorkingTime\Model\YearSummary;
use Symfony\Contracts\EventDispatcher\Event;
final class WorkingTimeYearSummaryEvent extends Event
{
public function __construct(private YearPerUserSummary $yearPerUserSummary, private \DateTimeInterface $until)
{
}
public function getYear(): Year
{
return $this->yearPerUserSummary->getYear();
}
public function getUntil(): \DateTimeInterface
{
return $this->until;
}
public function addSummary(YearSummary $yearSummary): void
{
$this->yearPerUserSummary->addSummary($yearSummary);
}
}