MVC models fails without any error messages when I moved to linux server from window. Below is the model and the view.
Model
class ListModel extends CActiveRecord {
const STATUS_PENDING = 0;
public static function model($className=__CLASS__) {
return parent::model($className);
}
public function tableName() {
return 'list_model';
}
public function rules() {
return array(
array('list_id,list_title,list_user,list_status', 'required'),
array('list_title', 'length', 'max' => 255),
array('list_id,list_status', 'numerical', 'integerOnly' => true),
);
}
public function attributeLabels() {
return array(
'list_id' => 'Id',
'list_title' => 'Title',
'list_user' => 'User',
'list_status' => 'Status',
);
}
public function search(){
$criteria = new CDbCriteria();
$criteria->compare('list_id',$this->list_id, true);
$criteria->compare('list_title',$this->list_title, true);
$criteria->compare('list_user',$this->list_user
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'sort'=>array('defaultOrder'=>'daillisting_complain_id DESC'),
));
}
public static function getCountPending(){
$sql = "SELECT COUNT('list_id') FROM list_model WHERE list_status=".self::STATUS_PENDING;
return (int) Yii::app()->db
->createCommand($sql)
->queryScalar();
}
View
$pending = ListModel::getCountPending();
//Fails to get fetch the count
$dataprovider = $model->search();
also fails
No error logs messages is displayed.
I have checked the error log.
In the view executing the fetchs the result
$sql = "SELECT COUNT(daillisting_complain_id) FROM daillisting_complain WHERE daillisting_complain_active=".self::STATUS_PENDING;
$pending = (int) Yii::app()->db
->createCommand($sql)
->queryScalar();
Initially I was getting the table does not exists due the case sensitive table names in linux. I renamed tables names.
Now the application fails in the models.
What is the solution?