Thanks Raoul.
I have this problem on auto update of the status on one of my table.
I have been reading your documentation and as well as the previous issues posted on this thread to find the solution but I was not able to got an answer or maybe I was not able to understand.
Maybe it is better to ask directly from the developer itself.
As what I have understand, the simpleworkflow extension it will handle the update of the status field of the model.
On my code, when a new record is created/inserted to the table, the status field is set automatically base on the initial status I set on the workflow files. That is without me doing anything to set the status.
However, when I update the record I expect it change the status to next status on my workflow. But it did not change.
What could be possible problem on this.
Below is the content of my swNotice.php on /protected/models/workflows:
return array(
'initial' => 'Draft',
'node' => array(
array('id'=>'Draft', 'transition'=>'Published',),
array('id'=>'Published')
)
);
Below is the code for my model update:
if(isset($_POST['Notice']))
{
$model->attributes=$_POST['Notice'];
$model->swNextStatus('swNotice/Draft');
if($model->save()){
$this->redirect(array('view','id'=>$model->id));
}
}
I believe the line $model->swNextStatus(‘swNotice/Draft’); will trigger the change but it won’t.
Am I right with this assumption, or do I need add some code somewhere else.
I also tried $model->swNextStatus(‘Draft’);, still the same result.
Right now, I just manually change the status with $model->status = ‘swNotice/Published’;
But I would really want to make this to auto change the status. Since I will be using the workflow on another model that will have 5 statuses.
I would greatly appreciate if you could enlighten me this problem of mine.
Thanks.