public function indexAction() { if (!$this->zfcUserAuthentication()->hasIdentity()) { return $this->redirect()->toRoute($this->zfcUserOptions->getLoginRedirectRoute()); } $user = $this->ZfcUserAuthentication()->getIdentity(); $form = $this->deleteConversationsForm; $conversations = $this->pmService->getUserConversations($user->getId()); // Paginator $paginator = new Paginator(new ArrayAdapter($conversations)); $page = $this->params('page', 1); $paginator->setDefaultItemCountPerPage($this->options->getConversationsPerPage()); $paginator->setCurrentPageNumber($page); $viewModel = new ViewModel(['conversations' => $paginator, 'form' => $form]); $viewModel->setTemplate('eye4web/zfc-user/pm/index.phtml'); $redirectUrl = $this->url()->fromRoute('eye4web/zfc-user/pm/list', ['page' => $page]); $prg = $this->prg($redirectUrl, true); if ($prg instanceof Response) { return $prg; } elseif ($prg === false) { return $viewModel; } $form->setData($prg); if (!$form->isValid()) { return $viewModel; } $this->pmService->deleteConversations($prg['collectionIds'], $user); return $this->redirect()->toRoute('eye4web/zfc-user/pm/list'); }