public function search() { // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria = new CDbCriteria(); $criteria->compare('id', $this->id); $criteria->compare('name', $this->name, true); $criteria->compare('code', $this->code, true); if ($this->type == null) { $this->type = Lookup::firstType(); } $criteria->compare('type', $this->type, true); $criteria->compare('position', $this->position); $criteria->order = 'position ASC'; return new CActiveDataProvider(get_class($this), array('criteria' => $criteria)); }