Cannot Instantiate Abstract Class Cactiverecord

I’m not sure if this error comes from PHP or Yii. What I’m doing is creating a class that extends CActiveRecord and add a static method:

class ActiveRecord extends CActiveRecord


    private static $_listData;

    public static function getListData($condition='', $params=array())


      if (is_null(self::$_listData))

        self::$_listData = CHtml::listData(self::model()->findAll($condition, $params), 'id', 'name');

      return self::$_listData;



so I can create a model (eg. User model) that extends ActiveRecord class and call getListData method by


(I’m intended to use it for Drop Down list in the view).

But I got this error:

What could be the problem?

All classes extending CActiveRecord MUST implement the model() method.

    public static function model($className=__CLASS__) {

        return parent::model($className);


Hmm… I think we only need to implement model() method if we extend CActiveRecord to define a model. In my case, I just extended it to add some methods, so we don’t have to. CMIIW.

Anyway, your reply led me to the real issue, I was calling self::model() which should be static::model() (thanks to late binding), and my code works fine now.

Thanks for your help :)