Skip to content

Instantly share code, notes, and snippets.

@raoul2000
Created June 27, 2015 15:47
Show Gist options
  • Save raoul2000/6fbe86707674f7c62a78 to your computer and use it in GitHub Desktop.
Save raoul2000/6fbe86707674f7c62a78 to your computer and use it in GitHub Desktop.
<?php
namespace app\models\wizflow;
use Yii;
use yii\base\Model;
use raoul2000\workflow\validation\WorkflowScenario;
/**
* ContactForm is the model behind the contact form.
*/
class Step1Form extends Model
{
public $favoriteColor;
public $status;
/**
* @return array the validation rules.
*/
public function rules()
{
return [
// name, email, subject and body are required
[['favoriteColor'], 'required'],
[['favoriteColor'], 'compare', 'compareValue' => 'blue', 'operator' => '==',
'on' => WorkflowScenario::enterStatus('Wizflow/blue')],
[['favoriteColor'], 'compare', 'compareValue' => 'green', 'operator' => '==',
'on' => WorkflowScenario::enterStatus('Wizflow/green')],
];
}
public function summary()
{
return 'you like '.$this->favoriteColor;
}
/**
* @return array customized attribute labels
*/
public function attributeLabels()
{
return [
'favoriteColor' => 'your favorite color',
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment