title: How to extend an activeRecord model in Yii
body: <p>I'm trying to create a form in Yii that is paged. Each page is for a group of fields. The best way to do this, I figured, would be to extend the ActiveRecord model and add a parameter for the current page. This also allows me to override the rules() methods with my own rules for the form itself.</p>
  
  <p>My problem with this is, Yii doesn't allow us to natively extend models. I had to override the getMetaData() method because Yii runs self::model(get_class($this)) on itself, which ends up breaking everything.</p>
  
  <p>Not only that, but I can't use findByPk because Yii relies heavily on the class name.</p>
  
  <p>I know of tons of work arounds to make this work, but I'm wondering if I'm missing something.</p>
  
  <p>Thanks,</p>
  
  <p>Kyle</p>
  
  <p>-- edit --</p>
  
  <p>I totally figured it out, and I totally feel stupid. All I had to do with overwrite the model() method to return the current model class.</p>
  
  <p>So:</p>
  
  <pre><code>class MyAr extends CActiveRecord {
      public static function model($class = __CLASS__){return parent::model($class);}
  }
  
  class ExtendedForm extends MyAr {
      public static function model($class = __CLASS__){return parent::model($class);}
  }
  </code></pre>
  
  <p>Yeah ... I feel stupid.</p>