Commit c6498f46 authored by Jacob Priddy's avatar Jacob Priddy 👌
Browse files

Paginate group schedule relationships

parent 79292bac
......@@ -3,16 +3,19 @@
namespace Source\UseCases\GroupSchedule;
use Source\Entities\Schedule;
use Source\Sanitize\Paginates;
use Source\UseCases\BasePresenter;
class APIPresenter extends BasePresenter implements Presenter
{
protected array $viewModel = [];
use Paginates;
protected array $schedules = [];
/** @inheritDoc */
public function present(ResponseModel $responseModel): void
{
$this->viewModel['schedules'] = array_map(function (Schedule $schedule) {
$this->schedules = array_map(function (Schedule $schedule) {
return $this->formatSchedule($schedule);
}, $responseModel->getSchedules());
}
......@@ -20,6 +23,6 @@ class APIPresenter extends BasePresenter implements Presenter
/** @inheritDoc */
public function getViewModel(): array
{
return $this->viewModel;
return $this->paginate($this->schedules);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment