Php Yii get all in子句仅按1键返回recerd
我有以下标准:Php Yii get all in子句仅按1键返回recerd,php,sql,yii,Php,Sql,Yii,我有以下标准: object(CDbCriteria)#186 (17) { ["select"]=> string(1) "*" ["distinct"]=> bool(false) ["condition"]=> string(17) "t.type IN (:type)" ["params"]=> array(1) { [":type"]=> string(3) "2,3"
object(CDbCriteria)#186 (17) {
["select"]=>
string(1) "*"
["distinct"]=>
bool(false)
["condition"]=>
string(17) "t.type IN (:type)"
["params"]=>
array(1) {
[":type"]=>
string(3) "2,3"
}
["limit"]=>
string(2) "50"
["offset"]=>
int(0)
["order"]=>
string(17) "t.order_date DESC"
["group"]=>
string(0) ""
["join"]=>
string(0) ""
["having"]=>
string(0) ""
["with"]=>
NULL
["alias"]=>
NULL
["together"]=>
NULL
["index"]=>
NULL
["scopes"]=>
NULL
["_e":"CComponent":private]=>
NULL
["_m":"CComponent":private]=>
NULL
}
我认为SQL查询必须如下所示:
SQL query must be SELECT * FROM `transaction` WHERE type IN (2,3);
$model::model()->findAll($criteria);
但问题是,我只在类型为2的地方得到记录,而在类型为3的地方得不到记录,为什么 请使用您需要的$criteria更新您的问题using@Tomas您的型号是否有
defaultScope
?如果是,请包括在内。另外,为了便于将来参考,您应该只添加$criteria
的声明和初始化,而不是转储。