Created
June 27, 2015 15:47
-
-
Save raoul2000/6fbe86707674f7c62a78 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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