您需要自定義搜索功能,如:
public function searchCandidates() {
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria = new CDbCriteria;
$criteria->with = array('candidate_relation');//this is a relation; you can pute here, relation_a.relation_b.relation_c
$criteria->compare('id', $this->id);
$criteria->compare('email', $this->email, true);
$criteria->compare('password', $this->password);
$criteria->compare('created', $this->created);
$criteria->compare('lastmodified', $this->lastmodified);
$criteria->compare('confirmed', $this->confirmed);
$criteria->compare('is_candidate', 1);
$criteria->compare('username', $this->username, true);
$criteria->compare('candidate_relation.first_name', $this->full_name, true);//and another relation here ...
$criteria->compare('candidate_relation.last_name', $this->full_name, true, 'OR');
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
));
}
其中full_name
是模型的自定義屬性:public $full_name;
是的,這是可能的,這就是cgridview如何工作 – 2013-03-19 18:19:44
當你從事件跳到要通知,yu可能需要HAS_MANY – 2013-03-19 18:27:00