public search ( ) : CActiveDataProvider | ||
return | CActiveDataProvider | the data provider that can return the models based on the search/filter conditions. |
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, true);
$criteria->compare('drug_set_id', $this->drug_set_id, true);
$criteria->compare('drug_id', $this->drug_id, true);
$criteria->compare('dose', $this->dose, true);
$criteria->compare('frequency_id', $this->frequency_id, true);
$criteria->compare('duration_id', $this->duration_id, true);
return new CActiveDataProvider(get_class($this), array('criteria' => $criteria));
}
/** * @covers DrugSetItem::search */ public function testSearch() { $this->model->setAttributes($this->drugsetitems('drugsetitem1')->getAttributes()); $results = $this->model->search(); $data = $results->getData(); $expectedKeys = array('drugsetitem1'); $expectedResults = array(); if (!empty($expectedKeys)) { foreach ($expectedKeys as $key) { $expectedResults[] = $this->drugsetitems($key); } } $this->assertEquals(1, $results->getItemCount()); $this->assertEquals($expectedResults, $data); }