Repository cleanup #40 (#41)

* added base classes for repositories and queries #40
* prepared controller and repositories to use fetchByQuery() #40
* removed findAll() which has added pagination to the original doctrine method #40
This commit is contained in:
Kevin Papst
2018-01-07 11:18:42 +01:00
committed by GitHub
parent 6931302c28
commit fa8e976e76
20 changed files with 257 additions and 298 deletions

View File

@@ -21,7 +21,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
use TimesheetBundle\Form\ProjectEditForm;
use TimesheetBundle\Repository\ProjectRepository;
use TimesheetBundle\Repository\Query\ProjectQuery;
/**
* Controller used to manage projects in the admin part of the site.
@@ -41,8 +41,12 @@ class ProjectController extends AbstractController
*/
public function indexAction($page)
{
$query = new ProjectQuery();
$query->setVisibility(ProjectQuery::SHOW_BOTH);
$query->setPage($page);
/* @var $entries Pagerfanta */
$entries = $this->getDoctrine()->getRepository(Project::class)->findAll($page);
$entries = $this->getDoctrine()->getRepository(Project::class)->findByQuery($query);
return $this->render('TimesheetBundle:admin:project.html.twig', ['entries' => $entries]);
}