I'm a Yii framework user.
mostly I define functions as public static function in my model files like the example function below.
public static function getTrashedPostCount(){
$connection=Yii::app()->db;
$sql = "SELECT COUNT(publish_status)
FROM {{post}}
WHERE publish_status = 'trash'";
$command=$connection->createCommand($sql);
$postCount = $command->queryScalar();
return $postCount;
}
I wonder if I'm doing wrong.
are most of functions in model files supposed to be static function?
Please let me know if I'm doing or understanding wrong.
Thanks!!!