The line:
in my User.php model file generates the error:
What "use" statement do I need to write at the start of the file? I have tried many things but cannot find the right one.
Background: I am trying to use the playground code but am getting in a real pickle.
I have added this to the User.php model (the one that comes with the advanced template), which generates the error:
public function search() {
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria = new CDbCriteria;
$criteria->compare('username', $this->username, true);
$criteria->compare('email', $this->email, true);
return new CActiveDataProvider(get_class($this), array(
'criteria' => $criteria,
'sort' => array(
'defaultOrder' => 'username ASC',
),
'pagination' => array(
'pageSize' => 5
),
));
}
Also, what does this do? Is it a constructor that automatically calls the function ‘search’?
$model =new User('search');
I have to write:
$u = new User;
$model = $u->search();
Instead of
$model =new User('search');
otherwise I get the error:
I am new to PHP so please be patient with my understanding of :: \ and ->.