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

@@ -22,6 +22,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
use TimesheetBundle\Form\ActivityEditForm;
use TimesheetBundle\Repository\ActivityRepository;
use TimesheetBundle\Repository\Query\ActivityQuery;
/**
* Controller used to manage activities in the admin part of the site.
@@ -41,8 +42,12 @@ class ActivityController extends AbstractController
*/
public function indexAction($page)
{
$query = new ActivityQuery();
$query->setVisibility(ActivityQuery::SHOW_BOTH);
$query->setPage($page);
/* @var $entries Pagerfanta */
$entries = $this->getDoctrine()->getRepository(Activity::class)->findAll($page);
$entries = $this->getDoctrine()->getRepository(Activity::class)->findByQuery($query);
return $this->render('TimesheetBundle:admin:activity.html.twig', ['entries' => $entries]);
}