yiisoft/yii — pull request #2252 by grikdotnet (2013-03-22 23:04:01+00:00)
Title: #2251 Added CActiveRecord::generateMetaData method, modified getMetaData...

Updated CActiveRecord:
added a method that can be overridden in the descendant classes
```php
protected static function generateMetaData($model)
{
return new CActiveRecordMetaData($model);
}
```
in model() replaced
$model->_md=new CActiveRecordMetaData($model);
to
$model->_md=call_user_func(array($model,'generateMetaData'),$model);

and in getMetaData()
return $this->_md=self::model(get_class($this))->_md;
to
$class = get_class($this);
return $this->_md=call_user_func(array($class,'generateMetaData'),$class);

This aloows avoiding a recursion during a model object creation.