Answer the question
In order to leave comments, you need to log in
How in yii to execute findAll in a model inherited from CActiveRecord?
Good afternoon.
Inherited ActiveRecord from CActiveRecord and in turn all models from ActiveRecord , so that all models have typical project-specific methods, for example, created such a method in ActiveRecord :
static function getAll(){
$criteria = new CDbCriteria();
$criteria->condition = 'EXIST = 1';
return self::findAll($criteria);
}
public function actionIndex()
{
$model = Project::getAll();
$this->render('index',array(
'model'=>$model
));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question