mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 14:25:00 +00:00
Feature: [docgen] order document template by name in list and in admin
This commit is contained in:
@@ -14,6 +14,8 @@ namespace Chill\DocGeneratorBundle\Controller;
|
||||
use Chill\DocGeneratorBundle\Context\ContextManager;
|
||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
@@ -84,4 +86,16 @@ class AdminDocGeneratorTemplateController extends CRUDController
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param QueryBuilder $query
|
||||
*
|
||||
* @return QueryBuilder|mixed
|
||||
*/
|
||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
||||
{
|
||||
return $query->addSelect('JSON_EXTRACT(e.name, :lang) AS HIDDEN name_lang')
|
||||
->setParameter('lang', $request->getLocale())
|
||||
->addOrderBy('name_lang', 'ASC');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user