Updates an existing entry
@param int $id   The Content id
774941
private function updatePost($id)
	{
		$model = $this->loadModel($id);

		if (!$this->user->role->hasPermission('modify'))
			throw new CHttpException(403, Yii::t('Api.content', 'You do not have permission to create new entries.'));

		if ($this->user->role->isA('author') || $this->user->role->isA('collaborator'))
			$model->author_id = $this->user->id;

		$vid 	= $model->vid;
		$model 	= new Content;
		$model->id = $id;
		$model->populate($_POST);
		$model->vid = Yii::app()->db->createCommand('SELECT MAX(vid)+1 FROM content WHERE id = :id')->bindParam(':id', $id)->queryScalar();

		if ($model->save())
			return $model->getAPIAttributes(array(
					'category_id',
					'parent_id',
					'author_id'
				),
				array(
					'author' => array(
						'password',
						'activation_key',
						'email',
						'about',
						'user_role',
						'status',
						'created',
						'updated'
					),
					'category' => array(
						'parent_id'
					),
					'metadata' => array(
						'content_id'
					)
				));

		return $this->returnError(400, NULL, $model->getErrors());
	}
777782
public function edit($id)
    {
        $this->loadModel('Menu.Menus');
        $menu = $this->Menus->get($id);

        if ($this->request->data()) {
            $menu = $this->Menus->patchEntity($menu, $this->request->data(), [
                'fieldList' => [
                    'title',
                    'description',
                    'settings',
                ],
                'validate' => false
            ]);

            if ($this->Menus->save($menu, ['atomic' => true])) {
                $this->Flash->success(__d('menu', 'Menu has been saved!'));
                $this->redirect($this->referer());
            } else {
                $this->Flash->danger(__d('menu', 'Menu could not be saved, please check your information'));
            }
        }

        $this->title(__d('menu', 'Editing Menu'));
        $this->set('menu', $menu);
        $this->Breadcrumb
            ->push('/admin/menu/manage')
            ->push(__d('menu', 'Editing menu {0}', $menu->title), '#');
    }
1181464
public function update(Request $request, $id)
    {
        $entry = $this->entriesRepository->getById($id, $this->resource);
        $this->validate($request, $this->validationRules($this->resource, $entry));

        $this->entriesRepository->update($id, $request, $this->resource);

        return redirect()->back()->with('success', 'Updated');
    }
57119
public function update($id, $content)
    {
        $content['id'] = $id;

        $result =  $this->request(
            'POST',
            $this->getCore(). '/update/json',
            [],
            [
                'add' => [
                    'doc' => $content
                ]
            ]
        );

        if ($this->isAutoCommit()) {
            $this->commit();
        }

        return $result;
    }
655424
public function setId( $id )
	{
		if ( $id === null ) {
			$this->_modified = true;
		}

		$this->_values['id'] = $id;
	}
679170
public function updateIDValue(&$id)
    {
        $owner = $this->owner;
        if ($owner->IDCustomValue) {
            $id = $owner->IDCustomValue;
        }
    }
365257
public function updateAction($id) {
        $entity = $this->container->get("haven_core.category.read_handler")->getOne($id);
        $delete_form = $this->container->get("haven_core.category.form_handler")->createDeleteForm($id);
        $edit_form = $this->container->get("haven_core.category.form_handler")->createEditForm($id);

        $request = $this->container->get('request_modifier')->setRequest($this->container->get("request"))
                ->slug(array("name"))
                ->getRequest();

        $edit_form->bind($request);
        if ($edit_form->isValid()) {
            $this->container->get("haven_core.category.persistence_handler")->save($edit_form->getData());

            $this->container->get("session")->getFlashBag()->add("success", "update.success");
            return new RedirectResponse($this->container->get('router')->generate(str_replace('update', "edit", $this->container->get("request")->get("_route")), array("id" => $entity->getId())));
        }

        $this->container->get("session")->getFlashBag()->add("error", "update.error");

        $template = str_replace(":update.html.twig", ":edit.html.twig", $this->container->get("request")->get('_template'));
        $params = array(
            'entity' => $entity,
            'edit_form' => $edit_form->createView(),
            'delete_form' => $delete_form->createView(),
        );

        return new Response($this->container->get('templating')->render($template, $params));
    }
698917
public function setId( $id )
	{
		if( $id === $this->getId() ) { return; }

		$this->_values['id'] = (string) $id ;
		$this->setModified();
	}
1232360
public function update_($resource, ...$id) {
		$this->_checkResource ( $resource, function () use ($id) {
			if (! $this->hasErrors ()) {
				parent::_update ( ...$id );
			} else {
				echo $this->displayErrors ();
			}
		} );
	}
238986
public function update($id)
	{
		$messages = $this->posts->validForUpdate($id, Input::get('title'), Input::get('slug'));

		if (count($messages) > 0)
		{
			return Response::json($messages->all(), 400);
		}

		$post = $this->posts->update(
			$id,
			Input::get('title'),
			Input::get('content'),
			Input::get('slug'),
			explode(',', Input::get('tags')),
			(bool) Input::get('active'),
			(int) Input::get('user_id'),
			Carbon::createFromTimestamp(strtotime(Input::get('publish_date')))
		);

		return (string) $this->posts->find($id);
	}
344253
public function update($id, $request)
    {
        $this->fireEvent('updating', [$id, $request]);

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

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

        return $updated;
    }
379018
public function update($id, Request $request)
    {
        return $this->updateModel($this->model()->find($id), $request->all(), 'edit');
    }
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();
    }
929520
public function setId($id)
    {
        if (is_null($this->id) && ! is_null($id) && ($model = $this->getRepository()->find($id))) {
            $this->id = $id;

            parent::setModel($model);
            $this->getButtons()->setModel($model);
            $this->setModelClass(get_class($model));
        }
    }
1314026
public function save(string $id, array $data)
    {
        $this->setFile($id);
        if ($this->file) {
            if (file_exists($this->file)) {
                $this->update($id, $data);
            } else {
                $this->add($id, $data);
            }
        }
    }
980655
public function actionUpdate($id)
    {
        if (request()->post('_asnew') == '1') {
            $model = new Product();
        } else {
            $model = $this->findModel($id);
        }
        if ($model->loadAll(request()->post())) {
            if ($model->saveAll()) {
                set_flash_has_been_saved();
                create_all_term_relationships_of_all_term_type_of_product_type($model->product_type, $model->primaryKey);
                create_all_meta_of_all_product_type_meta($model->product_type, $model->primaryKey);
            } else {
                set_flash_has_not_been_saved();
            }
        }

        return $this->render('update', [
            'model' => $model,
        ]);

    }
4468
public function setContentId( $id )
    {
        $this->contentId    = empty( $id ) ? null : (int) $id;
        $this->_uriCache    = null;
        $this->_visible     = null;
        return $this;
    }