title: How to change $model->attributes value in controller - Yii
body: <p>UserMasterController Code:</p>
  
  <pre><code>public function actionUpdate($id){
  
      $model=$this-&gt;loadModel($id);
  
      if(isset($_POST['UserMaster'])){
          $model-&gt;attributes=$_POST['UserMaster'];
          $model-&gt;attributes['emailsent'] = 'N';
  
          if($model-&gt;save())
              $this-&gt;redirect(array('admin'));
      }
  
      $this-&gt;render('update',array(
          'model'=&gt;$model,
      ));
  }
  </code></pre>
  
  <p>the line which gives me an error is : <code>$model-&gt;attributes['emailsent'] = 'N';</code></p>
  
  <blockquote>
    <p><strong>ERROR</strong> : Indirect modification of overloaded property <code>UserMaster::$attributes</code> has no effect</p>
  </blockquote>
  
  <p>How can I change the attribute value ? I just want to set it as <code>'Y'</code> or <code>'N'</code> as per the condition</p>