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

		$model = new Content;

		$model->populate($_POST);

		// Return a model instance to work with
		if ($model->savePrototype($this->user->id))
		{
			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 createNewPost()
	{
		if (!$this->user->role->hasPermission('create'))
			throw new CHttpException(403, Yii::t('Api.content', 'You do not have permission to create new entries.'));

		$model = new Content;

		$model->populate($_POST);

		// Return a model instance to work with
		if ($model->savePrototype($this->user->id))
		{
			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 createNewPost ( ) { if ( ! $ this -> user -> role -> hasPermission ( 'create' ) ) throw new CHttpException ( 403 , Yii :: t ( 'Api.content' , 'You do not have permission to create new entries.' ) ) ; $ model = new Content ; $ model -> populate ( $ _POST ) ; // Return a model instance to work with if ( $ model -> savePrototype ( $ this -> user -> id ) ) { 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 ( ) ) ; }
Creates a new entry
Creates a new entry