Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/CoreBundle/State/UserSessionSubscriptionsStateProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace Chamilo\CoreBundle\State;

use ApiPlatform\Doctrine\Orm\Extension\PaginationExtension;
use ApiPlatform\Doctrine\Orm\Paginator;
use ApiPlatform\Doctrine\Orm\Util\QueryNameGenerator;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface;
Expand Down Expand Up @@ -75,6 +76,20 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
$context
);

return $this->paginationExtension->getResult($qb, Session::class, $operation, $context);
$paginator = $this->paginationExtension->getResult($qb, Session::class, $operation, $context);

// Convert paginator to array since paginationEnabled is false
$result = $paginator;

if ($result instanceof Paginator) {
return iterator_to_array($result);
}

// If it's already an array or collection, convert to array
if (is_iterable($result)) {
return \is_array($result) ? $result : iterator_to_array($result);
}

return [];
}
}
Loading