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.
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.
Not only that, but I can’t use findByPk because Yii relies heavily on the class name.
I know of tons of work arounds to make this work, but I’m wondering if I’m missing something.
I am. However, there’s a lot of rules to my form for each page, and that doesn’t solve the fact that I have a “page” attribute on my form model, but not my AR model. I wanted to keep the ideas separate.