toolbar dropdown and visibility improvements (#933)

This commit is contained in:
Kevin Papst
2019-07-09 16:34:11 +02:00
committed by GitHub
parent b833e1ce27
commit c33a87a07c
74 changed files with 1317 additions and 631 deletions

View File

@@ -9,12 +9,11 @@
namespace App\Repository\Paginator;
use App\Repository\Loader\TimesheetLoader;
use App\Repository\Loader\LoaderInterface;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Pagerfanta\Adapter\AdapterInterface;
final class TimesheetPaginator implements AdapterInterface
final class LoaderPaginator implements PaginatorInterface
{
/**
* @var QueryBuilder
@@ -25,15 +24,15 @@ final class TimesheetPaginator implements AdapterInterface
*/
private $results = 0;
/**
* @var TimesheetLoader
* @var LoaderInterface
*/
private $loader;
public function __construct(QueryBuilder $query, int $results)
public function __construct(LoaderInterface $loader, QueryBuilder $query, int $results)
{
$this->loader = $loader;
$this->query = $query;
$this->results = $results;
$this->loader = new TimesheetLoader($query->getEntityManager());
}
/**
@@ -44,15 +43,6 @@ final class TimesheetPaginator implements AdapterInterface
return $this->results;
}
private function getResults(Query $query)
{
$results = $query->execute();
$this->loader->loadResults($results);
return $results;
}
/**
* {@inheritdoc}
*/
@@ -66,7 +56,16 @@ final class TimesheetPaginator implements AdapterInterface
return $this->getResults($query);
}
public function getAll()
private function getResults(Query $query)
{
$results = $query->execute();
$this->loader->loadResults($results);
return $results;
}
public function getAll(): iterable
{
return $this->getResults($this->query->getQuery());
}

View File

@@ -0,0 +1,22 @@
<?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\Repository\Paginator;
use Pagerfanta\Adapter\AdapterInterface;
interface PaginatorInterface extends AdapterInterface
{
/**
* Returns all available results without pagination.
*
* @return iterable
*/
public function getAll(): iterable;
}