@param ModelConfigurationInterface $model
@param Request $request
@param int $id

@return \Illuminate\Http\RedirectResponse

@throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
549804
public function postUpdate(ModelConfigurationInterface $model, Request $request, $id)
    {
        /** @var FormInterface $editForm */
        $editForm = $model->fireEdit($id);
        $item = $editForm->getModel();

        if (is_null($item) || ! $model->isEditable($item)) {
            abort(404);
        }

        $nextAction = $request->input('next_action');

        $backUrl = $this->getBackUrl($request);

        if ($editForm instanceof FormInterface) {
            try {
                $editForm->validateForm($request, $model);

                if ($editForm->saveForm($request, $model) === false) {
                    return redirect()->back()->with([
                        '_redirectBack'       => $backUrl,
                        'sleeping_owl_tab_id' => $request->get('sleeping_owl_tab_id') ?: null,
                    ]);
                }
            } catch (ValidationException $exception) {
                return redirect()->back()
                    ->withErrors($exception->validator)
                    ->withInput()
                    ->with([
                        '_redirectBack'       => $backUrl,
                        'sleeping_owl_tab_id' => $request->get('sleeping_owl_tab_id') ?: null,
                    ]);
            }
        }

        $redirectPolicy = $model->getRedirect();

        if ($nextAction == 'save_and_continue') {
            $response = redirect()->back()->with([
                '_redirectBack'       => $backUrl,
                'sleeping_owl_tab_id' => $request->get('sleeping_owl_tab_id') ?: null,
            ]);

            if ($redirectPolicy->get('edit') == 'display') {
                $response = redirect()->to(
                    $model->getDisplayUrl()
                )->with([
                    '_redirectBack'       => $backUrl,
                    'sleeping_owl_tab_id' => $request->get('sleeping_owl_tab_id') ?: null,
                ]);
            }
        } elseif ($nextAction == 'save_and_create') {
            $response = redirect()->to($model->getCreateUrl($request->except([
                '_redirectBack',
                '_token',
                'url',
                'next_action',
            ])))->with([
                '_redirectBack'       => $backUrl,
                'sleeping_owl_tab_id' => $request->get('sleeping_owl_tab_id') ?: null,
            ]);
        } else {
            $response = redirect()->to($request->input('_redirectBack', $model->getDisplayUrl()));
        }

        return $response->with('success_message', $model->getMessageOnUpdate());
    }
1185384
protected function findObject(Request $request, $id)
    {
        $configuration = $this->getConfiguration($request);

        if (!($object = $this->getRepository()->find($id))) {
            throw $this->createNotFoundException(
                sprintf('Object %s(%s) not found', $configuration->getEntityClass(), $id)
            );
        }

        return $object;
    }
624485
public function deleteAction(Request $request, $id)
        {
            /** @var User $oUser */
            $oUser = UserQuery::create()->findOneById($id);

            if (count($oUser) === 0) {
                throw $this->createNotFoundException('Unable to find User entity.');

            }
            $oUser->delete();

            return $this->redirect($this->generateUrl('backend_system_user'));
        }
112075
public function putAction(Request $request, $id)
    {
        /** @var Group $group */
        $group = $this->getDoctrine()
            ->getRepository(static::$entityName)
            ->findGroupById($id);

        try {
            if (!$group) {
                throw new EntityNotFoundException(static::$entityName, $id);
            } else {
                $em = $this->getDoctrine()->getManager();

                $name = $request->get('name');

                $group->setName($name);

                $this->setParent($group, $request);

                if (!$this->processRoles($group, $request->get('roles', []))) {
                    throw new RestException('Could not update dependencies!');
                }

                $em->flush();
                $view = $this->view($group, 200);
            }
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        } catch (RestException $re) {
            $view = $this->view($re->toArray(), 400);
        }

        return $this->handleView($view);
    }
208317
public function putAction(Request $request, $id)
    {
        try {
            /** @var ContactTitle $title */
            $title = $this->getDoctrine()
                ->getRepository(self::$entityName)
                ->find($id);

            if (!$title) {
                throw new EntityNotFoundException(self::$entityName, $id);
            } else {
                $name = $request->get('title');

                if (empty($name)) {
                    throw new RestException('There is no title-name for the given title');
                } else {
                    $em = $this->getDoctrine()->getManager();
                    $title->setTitle($name);

                    $em->flush();
                    $view = $this->view($title, 200);
                }
            }
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        } catch (RestException $exc) {
            $view = $this->view($exc->toArray(), 400);
        }

        return $this->handleView($view);
    }
1139650
public function activeTemplate(Request $request, $id)
    {
        // Find Template
        $mailTemplate = $this
            ->getDoctrine()
            ->getRepository($this->getParameter('pd_mailer.mail_template_class'))
            ->findOneBy(['id' => $id]);
        if (!$mailTemplate) throw $this->createNotFoundException();

        // Set Status
        $mailTemplate->setStatus(!$mailTemplate->getStatus());

        // Save
        $em = $this->getDoctrine()->getManager();
        $em->persist($mailTemplate);
        $em->flush();

        // Message
        $this->addFlash('success', 'changes_saved');

        // Redirect Back
        return $this->redirect($request->headers->get('referer') ?? $this->generateUrl('admin_mail_list'));
    }
311752
public function getAction(Request $request, $id)
    {
        $locale = $this->getRequestParameter($request, 'locale', true);
        $view = $this->responseGetById(
            $id,
            function($id) use ($locale) {
                return $this->getManager()->findByIdAndLocale($id, $locale);
            }
        );

        return $this->handleView($view);
    }
94607
public function update(Request $request, $id)
    {
        $configuration = Configuration::findOrFail($id);

        $value = $request->value;

        if ($request->serialize) {
            //if(!Hash::check($request->password, Auth::user()->password)){
            if (!Auth::attempt($request->only('password'), false, false)) {
                return back()->withErrors([trans('ticketit::admin.config-edit-auth-failed')]);
            }
            if (false === eval('$value = serialize('.$value.');')) {
                return back()->withErrors([trans('ticketit::admin.config-edit-eval-error')]);
            }
        }

        $configuration->update(['value' => $value, 'lang' => $request->lang]);

        Session::flash('configuration', trans('ticketit::lang.configuration-name-has-been-modified', ['name' => $request->name]));
        // refresh cached settings
        \Cache::forget('ticketit::settings');
        \Cache::forget('ticketit::settings.'.$configuration->slug);
        //return redirect(route('ticketit::admin.configuration.index'));
        return redirect()->action('\Kordy\Ticketit\Controllers\ConfigurationsController@index');
    }
723376
public function update(Request $request, $id)
    {
        $this->validate(
            $request,
            [
                'key' => 'required|string|unique:settings,key,' . $id,
                'value' => 'required'
            ]
        );
        $requestData = $request->all();

        $setting = Setting::findOrFail($id);
        $setting->update($requestData);

        return redirect('admin/settings')->with('flash_message', 'Setting updated!');
    }
154235
public function orderDown(ModelConfigurationInterface $model, $id)
    {
        /** @var OrderableModel $instance */
        $instance = $model->getRepository()->find($id);
        $instance->moveDown();

        return back();
    }
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();
    }
1008460
public function update(Request $request, $id)
    {
        /** @var \SymfonyId\AdminBundle\Configuration\ConfiguratorFactory $configuratorFactory */
        $configuratorFactory = $this->getConfiguratorFactory($this->getClassName());
        /** @var CrudConfigurator $crudConfigurator */
        $crudConfigurator = $configuratorFactory->getConfigurator(CrudConfigurator::class);

        $this->isGrantedOr404Error($crudConfigurator, Constants::ACTION_UPDATE);

        /** @var ModelInterface $model */
        $model = $this->findOr404Error($id);
        $form = $crudConfigurator->getForm($model, 'PUT');

        return $this->save($request, $form, $crudConfigurator);
    }
1096764
public function putAction(Request $request, $id)
    {
        $this->checkAccess('PUT', $id);
        $resource = $this->getResourceManager()->find($id);
        return $this->processPut($request, $resource);
    }
1354868
public function updateAction(Request $request, $id)
    {
        $this->registerBreadcrubms()->addItem($this->get("translator")->trans("Edit"));

        $entity = $this->getRepository()->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find ' . $this->getEntityName() . '.');
        }

        $form = $this->createEditForm($entity);

        $form->handleRequest($request);

        if ($form->isValid()) {
            /**
             * @var $em \Doctrine\ORM\EntityManager
             */
            $em = $this->getDoctrine()->getManager();

            try {
                if ($form->get("saveAndPublish")->isClicked()) {
                    $entity->setPublished(1);
                }
            } catch (OutOfBoundsException $e) {

            }

            if ($em->getUnitOfWork()->isScheduledForUpdate($entity)) {
                $this->get('session')->getFlashBag()->add('success', $this->getEntityName() . ' has been updated!');
            }

            $em->persist($entity);

            if (method_exists($entity, 'mergeNewTranslations')) {
                $entity->mergeNewTranslations();
            }

            $em->flush();

            if ($form->get("saveAndExit")->isClicked()) {
                return $this->redirect($this->generateUrl($this->getRouteName(), $this->getRouteParams()));
            } else {
                return $this->redirect($this->generateUrl($this->getRouteName() . 'Edit', $this->getRouteParams(['id' => $id])));
            }
        }

        return $this->render($this->getListTemplate() . ":edit.html.twig", [
            'entity' => $entity,
            'form' => $form->createView()
        ]);
    }
1209897
public function updateAction(Request $request, $id)
        {

            /** @var Customer $oCustomer */
            $oCustomer = CustomerQuery::create()->findOneById($id);

            if (count($oCustomer) === 0) {
                throw $this->createNotFoundException('Unable to find Customer entity.');
            }

            $deleteForm = $this->createDeleteForm($id);
            $editForm   = $this->createEditForm($oCustomer);
            $editForm->handleRequest($request);


            if ($editForm->isValid()) {


                $sLogoPath = $this->_handleLogoUpload($request, $oCustomer);
                $oCustomer->setLogo($sLogoPath);

                $oCustomer->save();

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

            return $this->render('SlashworksAppBundle:Customer:edit.html.twig', array(
                'entity'      => $oCustomer,
                'edit_form'   => $editForm->createView(),
                'delete_form' => $deleteForm->createView(),
            ));
        }
340415
public function multiselectSearch(Request $request, ModelConfigurationInterface $model, $field, $id = null)
    {
        return $this->selectSearch($request, $model, $field, $id);
    }
896159
public function handlePutDefault(Request $request, $model)
    {
        if (empty($request->id)) {
            throw new Exception(
                'No ID provided',
                static::ERROR_SCOPE | static::ERROR_NO_ID,
                BaseResponse::HTTP_BAD_REQUEST
            );
        }

        $updates = $this->parseRequestContent($request->content, $model->getResourceType());

        $model = $model::find($request->id);
        if (is_null($model)) {
            return null;
        }

        // fetch the original attributes
        $originalAttributes = $model->getOriginal();

        // apply our updates
        $model->fill($updates);

        // ensure we can get a succesful save
        if (!$model->save()) {
            throw new Exception(
                'An unknown error occurred',
                static::ERROR_SCOPE | static::ERROR_UNKNOWN,
                BaseResponse::HTTP_INTERNAL_SERVER_ERROR
            );
        }

        // fetch the current attributes (post save)
        $newAttributes = $model->getAttributes();

        // loop through the new attributes, and ensure they are identical
        // to the original ones. if not, then we need to return the model
        foreach ($newAttributes as $attribute => $value) {
            if (! array_key_exists($attribute, $originalAttributes) || $value !== $originalAttributes[$attribute]) {
                $model->markChanged();
                break;
            }
        }

        return $model;
    }