Hi
Is it possible to Convert actions to Web service ? I want to "DRY" and save time
for example , assume this code
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model=new Post;
if(isset($_POST['Post']))
{
$model->attributes=$_POST['Post'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('create',array(
'model'=>$model,
));
}
if we reflect to
public function actions()
{
return array(
'api'=>array(
'class'=>'CWebServiceAction',
),
);
}
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @soap
*/
public function actionCreate()
{
$model=new Post;
if(isset($_POST['Post']))
{
$model->attributes=$_POST['Post'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('create',array(
'model'=>$model,
));
}
how we can $_POST in web service client? it is possible ? I want to don’t create actionCreate twice , one for usually usage and one for web service client