i am having a Model called Activity, in that have the search() defined as below. but i cant think why when i call it this way this error prompts up..
Internal Server Error Property "CActiveDataProvider.select" is not defined.
Calling way..
//Get data $model = new $modelName(); if ($modelName === "Activity") $criteria = $model->search(); else $criteria = unserialize(base64_decode($criteria));
$rows = $model->commandBuilder->createFindCommand($model->tableSchema, $criteria)->queryAll();
what am i doing wrong here ? can anybody pls help me fix this
public function search() {
$criteria = new CDbCriteria();
$criteria->select = 't.id,t.activity_id,t.type,t.sub_type,t.name,t.description,t.source,t.delete_req,t.delete_reason,s.id as session_id, s.site_id,
s.location, s.start_time, s.end_time, j.id as Participants as s.closed, c.first_name, j.attended, c.managed_by_id';
$criteria->join = 'left join activity_sessions s on t.id = s.activities_id
left join activity_jobseekers j on s.id = j.session_id
left join contacts c on j.contact_id = c.id';
// Case insensitive compare
if (!empty($this->activity_id))
$criteria->addSearchCondition("t.activity_id", $this->activity_id.'%', false, 'AND', 'ILIKE');
if (!empty($this->type))
$criteria->addSearchCondition("t.type", $this->type.'%', false, 'AND', 'ILIKE');
if (!empty($this->sub_type))
$criteria->addSearchCondition("t.sub_type", $this->sub_type.'%', false, 'AND', 'ILIKE');
if (!empty($this->name))
$criteria->addSearchCondition("t.name", $this->name.'%', false, 'AND', 'ILIKE');
if (!empty($this->description))
$criteria->addSearchCondition("t.description", $this->description.'%', false, 'AND', 'ILIKE');
if ($this->source !== null)
$criteria->compare('t.source', $this->source, false);
$criteria->addCondition("t.delete_req='0'");
return new CActiveDataProvider('Activity', array(
'criteria'=>$criteria,
'sort'=>array('defaultOrder'=>'t.id ASC'),
'pagination'=>array('pageSize'=>Yii::app()->params['DefaultPageSize']),
));
}
U should return the CDbCriteria object rather than returning CActiveDataProvider provider object in search method..
hope this helps..