projectUserRoleModel->getActiveProjectsByUser($userId); foreach ($projects as $projectId => $projectName) { $query = $this->taskFinderModel->getUserQuery($userId)->eq(ProjectModel::TABLE.'.id', $projectId); $this->hook->reference('pagination:dashboard:task:query', $query); $paginator = $this->paginator ->setUrl('DashboardController', 'show', array('user_id' => $userId, 'pagination' => 'tasks-'.$projectId), 'project-tasks-'.$projectId) ->setMax(15) ->setOrder(TaskModel::TABLE.'.column_id') ->setDirection('ASC') ->setFormatter($this->taskListSubtaskAssigneeFormatter->withUserId($userId)) ->setQuery($query) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks-'.$projectId); if ($paginator->getTotal() > 0) { $paginators[] = array( 'project_id' => $projectId, 'project_name' => $projectName, 'paginator' => $paginator, ); } } return $paginators; } }