YII filtering by date does not work. why? YII & nbsp; filtering by date does not work. why? Model & lt ;? Php/** & nbsp; * & nbsp; This & nbsp; is & nbsp; the & nbsp; model & nbs YII does not work by date. why?
YII filtering by date does not work. why?
Model
/**
* This is the model class for table "user ".
*
* The followings are the available columns in table 'user ':
* @ Property integer $ id
* @ Property string $ uname
*/
Class Timefliter extends CActiveRecord
{
/**
* Returns the static model of the specified AR class.
* @ Param string $ className active record class name.
* @ Return User the static model class
*/
Public static function model ($ className =__ CLASS __)
{
Return parent: model ($ className );
}
/**
* @ Return string the associated database table name
*/
Public function tableName ()
{
Return 't_ time ';
}
Public $ starttime;
Public $ endtime;
/**
* @ Return array validation rules for model attributes.
*/
Public function rules ()
{
// NOTE: you shocould only define rules for those attributes that
// Will receive user inputs.
Return array (
Array ('id', 'Safe '),
// Array ('id', 'numerical ', 'integeronly' => true ),
Array ('time', 'Safe '),
// The following rule is used by search ().
// Please remove those attributes that shocould not be searched.
Array ('Id, Time', 'Safe ', 'on' => 'Search '),
);
}
/**
* @ Return array relational rules.
*/
Public function relations ()
{
// NOTE: you may need to adjust the relation name and the related
// Class name for the relations automatically generated below.
Return array (
);
}
/**
* @ Return array customized attribute labels (name => label)
*/
Public function attributeLabels ()
{
Return array (
'Id' => 'number ',
'Time' => 'time ',
);
}
/**
* Retrieves a list of models based on the current search/filter conditions.
* @ Return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
*/
Public function search ()
{
// Warning: Please modify the following code to remove attributes that
// Shocould not be searched.
$ Criteria = new CDbCriteria;
$ Criteria-> compare ('id', $ this-> id );
$ Criteria-> compare ('time', '> ='. $ this-> starttime );
$ Criteria-> compare ('time', '<='. $ this-> endtime );
// Whether to enable fuzzy search, which is implemented in true
Return new CActiveDataProvider ($ this, array (
'Criteria '=> $ criteria,
// 'Pagination' => array ('pagesize' => $ pagesize? Pagesize: $ page ),
// 'Pagination' => array ('pagesize' => $ page ),