title: how to define a scenario in Yii2?
body: <p>my model rules are like this</p>
  
  <pre><code>public function rules()
          {
              return [
                  [['email','password'], 'required'],
                  [['email'],'unique'],
                  [['status','role_id','created_by', 'updated_by', 'is_deleted'], 'integer'],
                  [['created_at', 'updated_at'], 'safe'],
                  [['first_name', 'last_name', 'email', 'username','location','address','about_me'], 'string', 'max' =&gt; 200],
                  [['phone'], 'string', 'max' =&gt; 100]
              ];
          }
  </code></pre>
  
  <p>while creating a new user i need email and password required, but during update i need only username required. how can i do this?</p>