@Route("/{id}/delete", name="victoire_redirection_delete")

@Method("DELETE")

@param Redirection $redirection

@return Response
5164
public function deleteAction(Redirection $redirection)
    {
        $em = $this->getDoctrine()->getManager();

        $em->remove($redirection);
        $em->flush();

        /** @var RedirectionRepository $redirectionRepository */
        $redirectionRepository = $em->getRepository('VictoireSeoBundle:Redirection');

        $this->congrat($this->get('translator')->trans('victoire.redirection.delete.success'));

        if (0 == count($redirectionRepository->getUnresolvedQuery()->getQuery()->getResult())) {
            return new Response($this->renderView('@VictoireSeo/Error404/_empty.html.twig'), 200, [
                'X-Inject-Alertify' => true,
            ]);
        }

        return new Response(null, 200, [
            'X-Inject-Alertify' => true,
            'X-VIC-Remove'      => '100ms',
        ]);
    }
777427
public function deleteAction(Request $request, Role $role): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('role', 'delete'));
        $form = $this->formFactory->deleteRole(
            new RoleDeleteData($role)
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (RoleDeleteData $data) {
                $role = $data->getRole();
                $this->roleService->deleteRole($role);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Role '%role%' removed.") */
                        'role.delete.success',
                        ['%role%' => $role->identifier],
                        'role'
                    )
                );

                return new RedirectResponse($this->generateUrl('ezplatform.role.list'));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('ezplatform.role.view', [
            'roleId' => $role->id,
        ]));
    }
827603
public function actionDelete($id)
    {
        $model = $this->findModel($id);
        $model->delete();

        return $this->redirect(['index']);
    }
1040194
public function handleDelete(int $id = null)
    {
        if ($id === null) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('users-list-page') . "?m=2");
            } else {
                return 'Redirect: ' . $this->router->generate('users-list-page') . "?m=2";
            }
        } elseif ($id === $this->core->auth()->details->id) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('users-list-page') . "?m=3");
            } else {
                return 'Redirect: ' . $this->router->generate('users-list-page') . "?m=3";
            }
        }
        $user = $this->core->api('User/' . $id, 'DELETE')->run();
        if ($user['headers'][0][2] === 422) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('users-list-page') . "?m=2");
            } else {
                return 'Redirect: ' . $this->router->generate('users-list-page') . "?m=2";
            }
        } elseif (($user["headers"][0][2] - 200) * ($user["headers"][0][2] - 299) > 0) {
            if (headers_sent() === false) {
                foreach ($response["headers"] as $header) {
                    header($header[0], $header[1], $header[2]);
                }
            }
            return $this->templates->render("500", [
                "error" => $user['response'],
                "result" => ''
            ]);
        }

        if (isset($_GET['template']) === false) {
            return redirect($this->router->generate('users-list-page') . "?m=1");
        } else {
            return 'Redirect: ' . $this->router->generate('users-list-page') . "?m=1";
        }
    }
436367
public function deleteAction(Request $request, $id)
    {
        /* @var $em EntityManager */
        $em = $this->getDoctrine()->getManager();

        $indexUrl = $this->getAdminListConfigurator()->getIndexUrl();
        if ($request->isMethod('POST')) {
            $em->getRepository('KunstmaanTranslatorBundle:Translation')->removeTranslations($id);
        }

        return new RedirectResponse($this->generateUrl($indexUrl['path'], isset($indexUrl['params']) ? $indexUrl['params'] : []));
    }
1071163
public function deleteAction(Request $request, $id)
    {
        $this->checkIfUserHasPermission(Permission::CREATE_DELETE);

        $this->getParentEntityDefinition($request);

        $entity = $this->getEntity($id);

        $this->getEventDispatcher()->dispatch(
            Events::PRE_CRUD_CONTROLLER_ACTION,
            new CrudControllerActionEvent($this->meta, __FUNCTION__)
        );

        $form = $this->getAdminFormFactory()->createDeleteForm($entity, $this->entityClass)->handleRequest($request);

        if ($this->getFormHandler()->handleDeleteForm($form, $entity)) {
            $this->getEventDispatcher()->dispatch(CrudEvents::DELETED, new DeletedEvent($this->getUser(), $entity));

            return $this->redirect($this->getAdminRouter()->generate($entity, $this->entityClass, AdminRouter::TYPE_INDEX));
        }

        $url = $request->headers->get(
            'referer',
            $this->getAdminRouter()->generate($entity, $this->entityClass, AdminRouter::TYPE_INDEX)
        );

        return $this->redirect($url);
    }
1216239
public function redirectByUrl($defaultRedirect = null, $key = null) {
		$redirectUrl = $this->getRedirectUrl($defaultRedirect, $key);

		return $this->_controller->redirect($redirectUrl);
	}
827288
public function deleteAction($redirectionId)
    {
        $redirection = $this->get('open_orchestra_model.repository.redirection')->find($redirectionId);
        $dm = $this->get('object_manager');
        $this->dispatchEvent(RedirectionEvents::REDIRECTION_DELETE, new RedirectionEvent($redirection));
        $dm->remove($redirection);
        $dm->flush();

        return array();
    }
585632
public function delete(Redirect $redirect)
    {
        $endpoint = '/admin/redirect/'.$redirect->id.'.json';
        $response = $this->request($endpoint, 'DELETE');
        return;
    }
454478
protected function updateDependingRedirects(RedirectInterface $newRedirect)
    {
        /** @var $existingRedirectForSourceUriPath Redirect */
        $existingRedirectForSourceUriPath = $this->redirectRepository->findOneBySourceUriPathAndHost($newRedirect->getSourceUriPath(), $newRedirect->getHost(), false);
        if ($existingRedirectForSourceUriPath !== null) {
            $this->removeAndLog($existingRedirectForSourceUriPath, sprintf('Existing redirect for the source URI path "%s" removed.', $newRedirect->getSourceUriPath()));
            $this->routerCachingService->flushCachesForUriPath($existingRedirectForSourceUriPath->getSourceUriPath());
        }

        /** @var $existingRedirectForTargetUriPath Redirect */
        $existingRedirectForTargetUriPath = $this->redirectRepository->findOneBySourceUriPathAndHost($newRedirect->getTargetUriPath(), $newRedirect->getHost(), false);
        if ($existingRedirectForTargetUriPath !== null) {
            $this->removeAndLog($existingRedirectForTargetUriPath, sprintf('Existing redirect for the target URI path "%s" removed.', $newRedirect->getTargetUriPath()));
            $this->routerCachingService->flushCachesForUriPath($existingRedirectForTargetUriPath->getSourceUriPath());
        }

        $obsoleteRedirectInstances = $this->redirectRepository->findByTargetUriPathAndHost($newRedirect->getSourceUriPath(), $newRedirect->getHost());
        /** @var $obsoleteRedirect Redirect */
        foreach ($obsoleteRedirectInstances as $obsoleteRedirect) {
            if ($obsoleteRedirect->getSourceUriPath() === $newRedirect->getTargetUriPath()) {
                $this->redirectRepository->remove($obsoleteRedirect);
            } else {
                $obsoleteRedirect->setTargetUriPath($newRedirect->getTargetUriPath());
                $this->redirectRepository->update($obsoleteRedirect);
            }
        }
    }
769004
public function indexAction(Request $request)
    {
        /** @var RedirectionRepository $errorRepository */
        $redirectionRepository = $this->getDoctrine()->getManager()->getRepository('VictoireSeoBundle:Redirection');

        // Fetch errors

        /** @var QueryBuilder $redirections */
        $redirections = $redirectionRepository->getUnresolvedQuery()->getQuery()->getResult();

        // Build forms

        $forms = [];

        /** @var Redirection[] $redirection */
        foreach ($redirections as $redirection) {
            $forms[$redirection->getId()] = $this->getRedirectionForm($redirection,
                sprintf('#redirection-%d-item-container', $redirection->getId())
            )->createView();
        }

        $newForm = $this->getRedirectionForm(new Redirection(), '#new-redirection-form-container')->createView();

        // Return datas

        return new Response($this->renderView('@VictoireSeo/Redirection/index.html.twig', [
            'newForm'      => $newForm,
            'redirections' => $redirections,
            'forms'        => $forms,
        ]));
    }
292665
public function redirect($url)
    {
        $location = $this->_request->getBasePath();
        $location = str_replace('//', '/', "{$location}/{$url}");
        $this->_response->setStatusCode(302);
        $header = new GenericHeader('Location', $location);
        $this->_response->getHeaders()->addHeader($header);
        return $this->disableRendering();
    }
1128152
private function redirect($method) {

		$this -> setUrl();
		$this -> setDomain();
		$this -> setMethod($method);
		
		Router :: setRedirect(true);

		return Router :: execute();
	}
91762
public function deleteAction(Request $request, $folderId)
    {
        $em = $this->getDoctrine()->getManager();

        /* @var Folder $folder */
        $folder = $em->getRepository('VictoireMediaBundle:Folder')->getFolder($folderId);
        $folderName = $folder->getName();
        $parentFolder = $folder->getParent();

        if (empty($parentFolder)) {
            $this->scold('You can\'t delete the \''.$folderName.'\' Folder!');
        } else {
            $folder->setDeleted(true);
            $em->persist($folder);
            $em->flush();
            $this->congrat('Folder \''.$folderName.'\' has been deleted!');
            $folderId = $parentFolder->getId();
        }

        return new RedirectResponse($this->generateUrl('VictoireMediaBundle_folder_show', ['folderId' => $folderId]));
    }
511047
public function deleteAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth(static::CONTROLLER_CHECK_RESOURCE, Dealer::getModuleCode(),
                AccessManager::DELETE)
        ) {
            return $response;
        }

        $con = Propel::getConnection();
        $con->beginTransaction();
        try {
            // Check token
            $this->getTokenProvider()->checkToken(
                $this->getRequest()->query->get("_token")
            );

            $this->getService()->deleteFromId($this->getRequest()->request->get(static::CONTROLLER_ENTITY_NAME . "_id"));
            $con->commit();
            if ($this->getRequest()->request->get("success_url") == null) {
                return $this->redirectToListTemplate();
            } else {
                return new RedirectResponse(URL::getInstance()->absoluteUrl($this->getRequest()->request->get("success_url")));
            }
        } catch (\Exception $e) {
            $con->rollBack();

            return $this->renderAfterDeleteError($e);
        }
    }
174121
public function deleteAction()
    {
        $entity = $this->loadEntity();
        //TODO: change method to post maybe
        $objectManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
        $objectManager->remove($entity);
        $objectManager->flush();

        $controller = explode('/', $this->getRequest()->getUri()->getPath())[2];

        if (!$this->getRequest()->isXmlHttpRequest()) {
            return $this->redirect()->toRoute(null, ['controller' => $controller]);
        }
        return;
    }
380938
public function destroy($id)
    {
        $currentUser = $this->users->getUser();

        if ($currentUser->id === (int) $id)
        {
            return Redirect::back()
                ->with('error', Lang::get('cpanel::users.delete_denied') );
        }

        try
        {
            $this->users->delete($id);
            return Redirect::route('cpanel.users.index')
                ->with('success',Lang::get('cpanel::users.delete_success'));
        }
        catch (UserNotFoundException $e)
        {
            return Redirect::route('cpanel.users.index')
                ->with('error',$e->getMessage());
        }
    }