mirror of
https://github.com/AzuraCast/AzuraCast.git
synced 2024-06-14 13:16:37 +00:00
Take advantage of the new pagination system's flexibility with joins.
This commit is contained in:
parent
ebe3d0a59e
commit
6afbe76a2d
|
@ -17,12 +17,12 @@ class Admin_ArtistsController extends \DF\Controller\Action
|
|||
if ($this->_hasParam('q'))
|
||||
{
|
||||
$this->view->q = $q = trim($this->_getParam('q'));
|
||||
$query = $this->em->createQuery('SELECT a FROM Entity\Artist a WHERE (a.name LIKE :q) ORDER BY a.name ASC')
|
||||
$query = $this->em->createQuery('SELECT a, at FROM Entity\Artist a LEFT JOIN a.types at WHERE (a.name LIKE :q) ORDER BY a.name ASC')
|
||||
->setParameter('q', '%'.$q.'%');
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = $this->em->createQuery('SELECT a FROM Entity\Artist a ORDER BY a.is_approved ASC, a.name ASC');
|
||||
$query = $this->em->createQuery('SELECT a, at FROM Entity\Artist a LEFT JOIN a.types at ORDER BY a.is_approved ASC, a.name ASC');
|
||||
}
|
||||
|
||||
$this->view->pager = new \DF\Paginator\Doctrine($query, $this->_getParam('page', 1), 30);
|
||||
|
|
|
@ -17,12 +17,12 @@ class Admin_UsersController extends \DF\Controller\Action
|
|||
{
|
||||
$this->view->q = $q = trim($this->getParam('q'));
|
||||
|
||||
$query = $this->em->createQuery('SELECT u FROM Entity\User u WHERE (u.name LIKE :query OR u.email LIKE :query) ORDER BY u.name ASC')
|
||||
$query = $this->em->createQuery('SELECT u, r FROM Entity\User u JOIN u.roles r WHERE (u.name LIKE :query OR u.email LIKE :query) ORDER BY u.name ASC')
|
||||
->setParameter('query', '%'.$q.'%');
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = $this->em->createQuery('SELECT u FROM Entity\User u ORDER BY u.name ASC');
|
||||
$query = $this->em->createQuery('SELECT u, r FROM Entity\User u JOIN u.roles r ORDER BY u.name ASC');
|
||||
}
|
||||
|
||||
$this->view->pager = new \DF\Paginator\Doctrine($query, $this->_getParam('page', 1), 50);
|
||||
|
|
Loading…
Reference in New Issue
Block a user