/** * @Route("/{id}/revoke", name="project_area_request_revoke") */ public function revokeAction($id, Request $request) { try { $repository = $this->get(self::REPOSITORY_NAME); $item = $repository->getItem($id); $question = new QuestionHelper($this->trans('Do you really want to revoke the request \'0\'? This operation cannot be undone.', [$item->getName()])); $question->onSuccess(function () use($repository, $item) { $repository->revoke($item); }); $question->respond('project_area_request_revoke', ['id' => $item->getId(), 'slug' => $this->getSlug()]); $question->path($this->crudInfo->getInfoPage(), ['id' => $item->getId(), 'slug' => $this->getSlug()]); $question->title($this->trans('AreaRequest: 0', [$item->getName()]), $this->crudInfo->getPageSubtitle()); $this->breadcrumbs()->link($item->getName(), $this->crudInfo->getInfoPage(), ['id' => $item->getId(), 'slug' => $this->getSlug()]); return $question->handleRequest($this, $request); } catch (ModelException $exception) { return $this->showPageWithError($exception->getMessage(), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); } }
public function performRevoke($id, Request $request) { try { $repository = $this->get(self::REPOSITORY_NAME); $item = $repository->getItem($id); $question = new QuestionHelper($this->trans('Do you want to revoke the route \'0\'?', [$item->getName()], 'edk')); $question->onSuccess(function () use($repository, $item) { $repository->revoke($item); }); $question->respond(self::REVOKE_PAGE, ['id' => $item->getId(), 'slug' => $this->getSlug()]); $question->path($this->crudInfo->getInfoPage(), ['id' => $item->getId(), 'slug' => $this->getSlug()]); $question->title($this->trans('EdkRoute: 0', [$item->getName()]), $this->crudInfo->getPageSubtitle()); $this->breadcrumbs()->link($item->getName(), $this->crudInfo->getInfoPage(), ['id' => $item->getId(), 'slug' => $this->getSlug()]); return $question->handleRequest($this, $request); } catch (ModelException $exception) { return $this->showPageWithError($exception->getMessage(), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); } }
/** * @Route("/prune", name="admin_registration_prune") */ public function pruneAction(Request $request) { try { $repository = $this->get(self::REPOSITORY_NAME); $question = new QuestionHelper($this->trans('PruneRegistrationsQuestionText')); $question->onSuccess(function () use($repository) { $number = $repository->pruneOld(); $this->get('session')->getFlashBag()->add('info', $this->trans('PrunedRegistrations: 0', [$number])); }); $question->respond('admin_registration_prune'); $question->path($this->crudInfo->getIndexPage()); $question->title($this->trans($this->crudInfo->getPageTitle()), $this->crudInfo->getPageSubtitle()); $this->breadcrumbs()->link($this->trans('Prune', [], 'general'), 'admin_registration_prune'); return $question->handleRequest($this, $request); } catch (ModelException $exception) { return $this->showPageWithError($exception->getMessage(), $this->crudInfo->getIndexPage()); } }