title: Yii - reacting to attribute model assignation
body: <p>I want to do the following in Yii:</p>
  
  <pre><code>When the attribute `a` in my model class `M` is set, do something.
  </code></pre>
  
  <p>AND tried using a setter like: <code>setA($value)</code> but it's not called since Yii <code>CActiveRecord</code> first detects if the attribute exists in database (and assigns it) and <strong>if it does not exist in database</strong> (i.e. it's not a table attribute) then a normal instance variable is looked up. The final fallback is calling a property accesor.</p>
  
  <p>(<strong>Edit</strong> - I was wrong with resolution order: the lookup seems to be first to an instance variable, then to an attribute, and finally to an accessor - anyway, my problem is still the same since the accesor is resolved if no database field exists with that name)</p>
  
  <p><a href="https://github.com/yiisoft/yii/blob/1.1.14/framework/db/ar/CActiveRecord.php#L154" rel="nofollow">Here</a> it's shown the internal mechanics of __set (and a bit upper, the __get).</p>
  
  <p><strong>Question</strong>: How can I invert the order, at least for a certain attribute? This means: I actually WANT to capture the database field edition with a setter like <code>setA($value)</code>, performing the field assignation (i.e. the actual $this->a, however it should be done without falling in a stack overflow error) inside the <code>setA</code> method</p>