I have a problem retrieving multiple rows using multiple keys with CActiveDataProvider, I tried:
$details = new CActiveDataProvider('TransactionDetail', array(
'criteria' => array(
'condition' => 't.id IN (:itemId)',
'params' => array(':itemId' => '49,50'), //hardcoded string
'with' => 'item',
),
'pagination' => array(
'pageSize'=>self::PAGE_SIZE,
),
));
and
$details = new CActiveDataProvider('TransactionDetail', array(
'criteria' => array(
'condition' => 't.id IN (:itemId)',
'params' => array(':itemId' => array(49,50)), //array
'with' => 'item',
),
'pagination' => array(
'pageSize'=>self::PAGE_SIZE,
),
));
The first only returns itemId 49, whereas the second code returns nothing, is there a solution for this?
I also tried this:
$criteria = new CDbCriteria;
$criteria->with = 'item';
$criteria->addInCondition('itemId',array(49,50));
//load the details
$details = new CActiveDataProvider('TransactionDetail', array(
'criteria' => $criteria,
'pagination' => array(
'pageSize'=>self::PAGE_SIZE,
),
));
But I got nothing…