mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
FIXED: [api] sort socialactions by ordering
https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/677
This commit is contained in:
parent
5a93e21758
commit
8e65b3851a
@ -13,7 +13,9 @@ namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@ -41,7 +43,12 @@ class SocialWorkSocialActionApiController extends ApiController
|
||||
throw $this->createNotFoundException('socialIssue not found');
|
||||
}
|
||||
|
||||
$socialActions = $socialIssue->getRecursiveSocialActions();
|
||||
$socialActions = $socialIssue->getRecursiveSocialActions()->toArray();
|
||||
|
||||
usort($socialActions, function (SocialAction $sa, SocialAction $sb) {
|
||||
return $sa->getOrdering() <=> $sb->getOrdering();
|
||||
});
|
||||
|
||||
$pagination = $this->paginator->create(count($socialActions));
|
||||
// max one page
|
||||
$pagination->setItemsPerPage(count($socialActions));
|
||||
|
Loading…
x
Reference in New Issue
Block a user