Query hints & persistent cache for latest approvals (#5176)

This commit is contained in:
Kevin Papst
2024-11-25 21:04:53 +01:00
committed by GitHub
parent 46c4449504
commit f13b81ede7
11 changed files with 162 additions and 81 deletions

View File

@@ -13,20 +13,25 @@ use App\Entity\ExportableItem;
use App\Entity\Timesheet;
use App\Invoice\InvoiceItemRepositoryInterface;
use App\Repository\Query\InvoiceQuery;
use App\Repository\Query\TimesheetQueryHint;
final class TimesheetInvoiceItemRepository implements InvoiceItemRepositoryInterface
{
public function __construct(private TimesheetRepository $repository)
public function __construct(private readonly TimesheetRepository $repository)
{
}
/**
* @param InvoiceQuery $query
* @return ExportableItem[]
*/
public function getInvoiceItemsForQuery(InvoiceQuery $query): iterable
{
return $this->repository->getTimesheetsForQuery($query, true);
$query->addQueryHint(TimesheetQueryHint::CUSTOMER_META_FIELDS);
$query->addQueryHint(TimesheetQueryHint::PROJECT_META_FIELDS);
$query->addQueryHint(TimesheetQueryHint::ACTIVITY_META_FIELDS);
$query->addQueryHint(TimesheetQueryHint::USER_PREFERENCES);
return $this->repository->getTimesheetResult($query)->getResults();
}
/**