Simpleworflow Allstatuslistdata Helper Not Returning Any Data

I used the simpleworflow extension and follow the instructions to setup here.

I got the other parts working aside from the allStatuslistData helper.

It is expected to return the list of all status.

echo $form->dropDownList($model,‘status’,SWHelper::allStatuslistData($model));

Do i missed something

Hi Jan,

yes indeed, allStatuslistData should return a list of all status for the model.

Can you verify that your model is actually included into a workflow ? … just echo $model->status




I did check if the workflow is included by using echo $model->status. And it return nothing.

By the way I used the allStatuslistData on _search.php view from the actionAdmin.

The codes there are auto generated.

Do i need to explicitly add the workflow? I assumed it would be added by having the behavior method on the corresponding model.

Hi Jan,

If $model->status returns nothing, then your model is not in a workflow and it is normal that SWHelper::allStatuslistData($model) returns nothing as it can’t find a workflow associated to $model.

So now the question is : how come your model is not in a workflow when you expected it to be ?

You’re right, if you attache the behavior to the model, by default onAttach() the behavior will insert the model into a workflow named according to the model class name prefixed with ‘sw’.

So, if you didn’t set any attribute value in the behavior declaration, and assuming your model class name is Post your model should be automatically inserted into workflow swPost. Of course the definition of the swPost workflow should also be accessible and correct.

If you have logs enabled note that the simpleWorkflow extension logs into the category "application.simpleWorkflow" …



Hi Raoul,

I assume lines below on my model add it to the workflow:

function behaviors()


    return array(


            'class' => 'application.extensions.simpleWorkflow.SWActiveRecordBehavior',




I also add necessary configurations on the components:

‘swSource’=> array(



as well as the import:

‘application.extensions.simpleWorkflow.*’, // Import simpleWorkflow extension

Can you help me point out what I missed?

I’m new to Yii, this is just my second week working on it.


This seems to be correct.

What about the workflow definition file itself ? What is the class name of your model ? Does it inherit from CActiveRecord ?

You could try to print :

   echo $model->swGetDefaultWorkflowId();

   echo $model->swGetWorkflowId();

If you have a way to share your code I’ll do my best to help you …



I had User model and it also inherited from CActiveRecord

class User extends CActiveRecord

The workflow definition file is in /protected/models/workflows/swUser


	return array(

		'initial' => 'New',

		'node' => array(

			array('id'=>'New', 'transition'=>'Active'),

			array('id'=>'Active', 'transition'=>'Inactive')




These are the result on the echo statements you recommended to check:

swGetDefaultWorkflowId: swUser


By the way my problem is on my actionAdmin, below is the code for the action:

$model=new User('search');

		$model->unsetAttributes();  // clear any default values






Do I need to add some lines on the controller action?

Then this is the code in my _search.php view file.

<?php echo $form->dropDownList($model,'status',SWHelper::allStatuslistData($model)); ?> 


my first guess is : try to comment the $model->unsetAttributes() line …


Thanks for the help.

I got it now.