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());
	}
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());
	}
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 ( ) ) ; }
Updates an existing entry
@param int $id   The Content id
Updates an existing entry