first_name と last_name を連結した full_name に基づいて検索しようとしていますが、エラーが発生し続けます。
これは私のコントローラーがどのように見えるかです:
$criteria = new CDbCriteria;
$criteria->addSearchCondition('full_name',$customer_search);
$customers = Customer::model()->findAll($criteria);
私の Customer モデルには、full_name を返すメソッドがあります。
public function getFull_name() {
return $this->first_name.' '.$this->last_name;
}
しかし、私はこのエラーが発生します:
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'full_name' in 'where clause'. The SQL statement executed was: SELECT * FROM `customer` `t` WHERE full_name LIKE :ycp0
first_name と last_name の両方を検索できるようにする必要があります。これを機能させるには何を変更する必要がありますか?