@param Request $request
@param int $id

@return Response
963457
public function editCollectionAction(Request $request, $id)
    {
        $em = $this->get('doctrine.orm.entity_manager');
        $collection = $em->find(Collection::class, $id);

        if (empty($collection)) {
            return $this->redirectToRoute('cms_admin_config_media');
        }

        $form = $this->createForm(CollectionFormType::class, $collection);
        $form->add('update', SubmitType::class, ['attr' => ['class' => 'btn btn-success']]);
        $form->add('cancel', SubmitType::class, ['attr' => ['class' => 'btn-default', 'formnovalidate' => 'formnovalidate']]);

        if ($request->isMethod('POST')) {
            $form->handleRequest($request);

            if ($form->get('cancel')->isClicked()) {
                return $this->redirectToRoute('cms_admin_config_media');
            }

            if ($form->isValid()) {
                $this->persist($form->getData(), true);
                $this->addFlash('success', 'Коллекция обновлена');

                return $this->redirectToRoute('cms_admin_config_media');
            }
        }

        return $this->render('@CMS/AdminMediaLibrary/edit_collection.html.twig', [
            'form'   => $form->createView(),
        ]);
    }
785921
public function historyAction(Request $request, $id)
    {
        $document = $this->get('ongr_translations.translation_manager')->get($id);

        if (empty($document)) {
            return new JsonResponse(['error' => true, 'message' => 'translation not found']);
        }

        return new JsonResponse($this->get('ongr_translations.history_manager')->get($document));
    }
1368678
public function destroy(Request $request, $id)
    {
        $forceDelete = $request->get('force', false);

        $block = $this->repository->getByIdWithTrashed($id);

        if (!empty($block)) {
            $this->authorize('delete', $block);
            if ($forceDelete) {
                $this->repository->forceDelete($block);
            } else {
                $this->repository->delete($block);
            }
            return $this->respondWithSimpleSuccess(['success' => true]);
        }
        return $this->respondNotFound();
    }
59764
public function show($id,Request $request)
    {
        if($request->ajax())
        {
            return URL::to('setting/'.$id);
        }

        $setting = Setting::findOrfail($id);
        return view('setting.show',compact('setting'));
    }
1290743
public function update($id, Request $request)
    {
        $this->validate($request, NavigationAdmin::$rules, NavigationAdmin::$messages);

        $inputs = $request->only([
            'icon',
            'title',
            'slug',
            'description',
            'help_index_title',
            'help_index_content',
            'help_create_title',
            'help_create_content',
            'help_edit_title',
            'help_edit_content',
            'parent_id',
            'url_parent_id'
        ]);
        $inputs['is_hidden'] = boolval($request->has('is_hidden'));

        $navigation = NavigationAdmin::findOrFail($id);
        $navigation = $this->updateEntry($navigation, $inputs);
        $navigation->updateUrl()->save();
        $navigation->roles()->sync(input('roles'));

        return redirect_to_resource();
    }
782321
public function update(Request $request, $id)
	{
		$request = $this->getRequest();

		$this->getModel()->getRepository()->update($id, $request->all());

		return $this->response()
			->success("L'élément a été modifiée avec succès.")
			->redirect($this->getEndpoint());
	}
208064
public function redirectAction(Request $request, $id)
    {
        $locale = $this->getRequestParameter($request, 'locale', true);
        $format = $this->getRequestParameter($request, 'format');

        /** @var Media $media */
        $media = $this->container->get('sulu_media.media_manager')->getById($id, $locale);

        if (null === $format) {
            return $this->redirect($media->getUrl());
        }

        if (!array_key_exists($format, $media->getFormats())) {
            throw $this->createNotFoundException();
        }

        return $this->redirect($media->getFormats()[$format]);
    }
1159164
public function viewAction(Request $request, $id)
    {
        $manager = $this->get('opifer.content.content_manager');
        $content = $manager->getRepository()->find($id);

        $content = $this->get('jms_serializer')->serialize($content, 'json');

        return new Response($content, 200, ['Content-Type' => 'application/json']);
    }
1360990
public function copyAction(Request $request, $id)
    {
        /** @var PageInterface $page */
        $page = $this->admin->getObject($id);

        if (!$page) {
            throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
        }

        if ($request->getMethod() == 'POST') {
            $pageHelper = $this->container->get('networking_init_cms.helper.page_helper');

	        $pageCopy = false;
            try {
                $pageCopy = $pageHelper->makePageCopy($page);
                $this->admin->createObjectSecurity($pageCopy);
                $status = 'success';
                $message = $this->translate(
                    'message.copy_saved',
                    ['%page%' => $pageCopy]
                );
                $result = 'ok';
                $html = $this->renderView(
                    '@NetworkingInitCms/PageAdmin/page_translation_settings.html.twig',
                    ['object' => $page, 'admin' => $this->admin]
                );
            } catch (\Exception $e) {
                $status = 'error';
                $message = $message = $this->translate(
                    'message.copy_not_saved',
                    ['%page%' => $page, '%url%' => $page->getFullPath()]
                );
                $result = 'error';
                $html = '';
            }

            if ($this->isXmlHttpRequest()) {
                return $this->renderJson(
                    [
                        'result' => $result,
                        'status' => $status,
                        'html' => $html,
                        'message' => $message,
                    ]
                );
            }

            $this->get('session')->getFlashBag()->add(
                'sonata_flash_'.$status,
                $message
            );

            if($pageCopy){
	            $request->getSession()->set('Page.last_edited', $pageCopy->getId());
            }


            return $this->redirect($this->admin->generateUrl('list'));
        }

        return $this->renderWithExtraParams(
            '@NetworkingInitCms/PageAdmin/page_copy.html.twig',
            [
                'language' => \Locale::getDisplayLanguage($page->getLocale()),
                'action' => 'copy',
                'page' => $page,
                'id' => $id,
                'admin' => $this->admin,
            ]
        );
    }
344253
public function update($id, $request)
    {
        $this->fireEvent('updating', [$id, $request]);

        $updated = $this->find($id)->update($request);

        $this->fireEvent('updated', [$id, $updated]);

        return $updated;
    }
302652
public function destroy($id, Request $request)
    {
        $model = $this->model();

        $force = false;
        if (method_exists($model, 'forceDelete')) {
            $this->validate($request, ['force' => ['boolean']]);

            $model = $model->withTrashed();
            $force = (bool) $request->input('force');
        }

        return $this->deleteModel($model->find($id), 'delete', $force);
    }
77903
public function editAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        $site = $em->getRepository(Site::class)->find($id);

        $originalDomains = new ArrayCollection();
        foreach ($site->getDomains() as $domain) {
            $originalDomains->add($domain);
        }

        $form = $this->createForm(SiteType::class, $site);
        $form->handleRequest($request);


        if ($form->isSubmitted() && $form->isValid()) {

            // Remove deleted domains
            foreach ($originalDomains as $domain) {
                if (false === $site->getDomains()->contains($domain)) {
                    $em->remove($domain);
                }
            }

            // Add new domain
            foreach ($form->getData()->getDomains() as $domain) {
                $domain->setSite($site);
            }
            $em->persist($domain);

            $em->flush();

            return $this->redirectToRoute('opifer_cms_site_edit', ['id' => $site->getId()]);
        }

        return $this->render('OpiferCmsBundle:Backend/Site:edit.html.twig', [
            'form' => $form->createView(),
            'site' => $site,
        ]);
    }
252365
public function update(Request $request, $id = null)
    {
        return $this->processor->update($this, $id, $request->all());
    }
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);
    }
1034741
public function copyAction(Request $request, $id)
    {
        $this->checkIfUserHasPermission(Permission::CREATE_DELETE);

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

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

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

        $copy = $this->getFormHandler()->handleCopyForm($form, $entity);

        if (!empty($copy)) {
            $this->getEventDispatcher()->dispatch(CrudEvents::COPIED, new CopiedEvent($this->getUser(), $entity, $copy));
        }

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

        return new RedirectResponse($url);
    }
520982
public function formAction($id, Request $request)
    {
        if (is_null($id)) {
            throw new RouteNotFoundException();
        }

        return parent::formAction($id, $request);
    }
417709
public function editAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        $template = $em->getRepository('OpiferContentBundle:Template')->find($id);

        $form = $this->createForm(TemplateType::class, $template);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em->flush();

            return $this->redirectToRoute('opifer_cms_template_edit', ['id' => $template->getId()]);
        }

        return $this->render('OpiferCmsBundle:Backend/Template:edit.html.twig', [
            'form' => $form->createView(),
            'template' => $template,
        ]);
    }