order query for location and add pagination in list

This commit is contained in:
Julien Fastré 2022-04-07 21:08:11 +02:00
parent f64409e5e6
commit 26a4577420
2 changed files with 8 additions and 0 deletions

View File

@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Controller; namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController; use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class LocationController extends CRUDController class LocationController extends CRUDController
@ -29,4 +30,9 @@ class LocationController extends CRUDController
{ {
$query->where('e.availableForUsers = true'); //TODO not working $query->where('e.availableForUsers = true'); //TODO not working
} }
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
return $query->addOrderBy('e.name', 'DESC');
}
} }

View File

@ -47,6 +47,8 @@
</tbody> </tbody>
</table> </table>
{{ chill_pagination(paginator) }}
<ul class="record_actions"> <ul class="record_actions">
<li> <li>
<a href="{{ path('chill_crud_main_location_new') }}" class="btn btn-create"> <a href="{{ path('chill_crud_main_location_new') }}" class="btn btn-create">