Component extending CActiveRecord


I need to have a class extending CActiveRecord.

I want to make it a component, in which case it would have to be a subclass of CComponent, right?

However PHP doesn’t have multiple inheritance, so I’m not sure how to subclass from both. This seems like it would be a fairly common problem faced by Yii developers. Is there a fairly standard (non-kludgy) solution to this?


CActiveRecord extends CModel, which extends CComponent, so you should be alright to just extend CActiveRecord.

Thank ye kindly!

It didn’t occur to me to look for such a possibility, will try to be more aware of such approaches next time.