mirror of
https://github.com/wallabag/wallabag.git
synced 2025-01-08 16:05:25 +00:00
Merge pull request #2013 from wallabag/fix-display-all-tags
Fix tags listing
This commit is contained in:
commit
97c8eb3c23
4 changed files with 6 additions and 36 deletions
|
@ -81,7 +81,7 @@ class TagController extends Controller
|
|||
{
|
||||
$tags = $this->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:Tag')
|
||||
->findTags($this->getUser()->getId());
|
||||
->findAllTags($this->getUser()->getId());
|
||||
|
||||
return $this->render(
|
||||
'WallabagCoreBundle:Tag:tags.html.twig',
|
||||
|
|
|
@ -3,41 +3,9 @@
|
|||
namespace Wallabag\CoreBundle\Repository;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Pagerfanta\Adapter\DoctrineORMAdapter;
|
||||
use Pagerfanta\Pagerfanta;
|
||||
|
||||
class TagRepository extends EntityRepository
|
||||
{
|
||||
/**
|
||||
* Return only the QueryBuilder to retrieve all tags for a given user.
|
||||
*
|
||||
* @param int $userId
|
||||
*
|
||||
* @return QueryBuilder
|
||||
*/
|
||||
private function getQbForAllTags($userId)
|
||||
{
|
||||
return $this->createQueryBuilder('t')
|
||||
->leftJoin('t.entries', 'e')
|
||||
->where('e.user = :userId')->setParameter('userId', $userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find Tags and return a Pager.
|
||||
*
|
||||
* @param int $userId
|
||||
*
|
||||
* @return Pagerfanta
|
||||
*/
|
||||
public function findTags($userId)
|
||||
{
|
||||
$qb = $this->getQbForAllTags($userId);
|
||||
|
||||
$pagerAdapter = new DoctrineORMAdapter($qb);
|
||||
|
||||
return new Pagerfanta($pagerAdapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find Tags.
|
||||
*
|
||||
|
@ -47,7 +15,9 @@ class TagRepository extends EntityRepository
|
|||
*/
|
||||
public function findAllTags($userId)
|
||||
{
|
||||
return $this->getQbForAllTags($userId)
|
||||
return $this->createQueryBuilder('t')
|
||||
->leftJoin('t.entries', 'e')
|
||||
->where('e.user = :userId')->setParameter('userId', $userId)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
{% block content %}
|
||||
<div class="results">
|
||||
<div class="nb-results">{{ 'tag.list.number_on_the_page'|transchoice(tags.count) }}</div>
|
||||
<div class="nb-results">{{ 'tag.list.number_on_the_page'|transchoice(tags|length) }}</div>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
{% block content %}
|
||||
<div class="results clearfix">
|
||||
<div class="nb-results left">{{ 'tag.list.number_on_the_page'|transchoice(tags.count) }}</div>
|
||||
<div class="nb-results left">{{ 'tag.list.number_on_the_page'|transchoice(tags|length) }}</div>
|
||||
</div>
|
||||
<br />
|
||||
<ul class="row data">
|
||||
|
|
Loading…
Reference in a new issue