use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Wallabag\CoreBundle\Entity\Entry;
-use Wallabag\CoreBundle\Entity\Tag;
/**
* The try/catch can be removed once all formats will be implemented.
{
$method = ucfirst($category);
$methodBuilder = 'getBuilderFor'.$method.'ByUser';
+ $repository = $this->get('wallabag_core.entry_repository');
if ($category == 'tag_entries') {
- $tag = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findOneBySlug($request->query->get('tag'));
+ $tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag'));
- $entries = $this->getDoctrine()
- ->getRepository('WallabagCoreBundle:Entry')
- ->findAllByTagId($this->getUser()->getId(), $tag->getId());
+ $entries = $repository->findAllByTagId(
+ $this->getUser()->getId(),
+ $tag->getId()
+ );
} else {
- $entries = $this->getDoctrine()
- ->getRepository('WallabagCoreBundle:Entry')
+ $entries = $repository
->$methodBuilder($this->getUser()->getId())
->getQuery()
->getResult();