this change adds an option to sort the feed entires by updated_at

There is now an option to sort the feed entires by updated_at, on the
controler : a sort querystring argument that accepts either "created"
or "updated".
This commit is contained in:
Adrien Gallou
2022-03-10 08:06:55 +01:00
parent 6bd257a711
commit 29df8ed590
4 changed files with 87 additions and 8 deletions

View File

@ -343,9 +343,9 @@ class EntryRepository extends EntityRepository
*
* @return array
*/
public function findAllByTagId($userId, $tagId)
public function findAllByTagId($userId, $tagId, $sort = 'createdAt')
{
return $this->getSortedQueryBuilderByUser($userId)
return $this->getSortedQueryBuilderByUser($userId, $sort)
->innerJoin('e.tags', 't')
->andWhere('t.id = :tagId')->setParameter('tagId', $tagId)
->getQuery()