Reputation: 3435
I got problem with active record
in yii
. So the basic problem is how to define USE INDEX()
mySQL criteria as CDbCriteria to pass it to CActivedataprovider.
I didn't find it in api or in code. Maybe someone already had this problem before and can share his solution.
Thank you.
Upvotes: 3
Views: 1092
Reputation: 306
If you use yii2 you can do it like this:
$yourQuery = YourModel::find()
->select(['*'])
->from(['yourTable USE INDEX(index1, index2, index3)']);
Upvotes: 1
Reputation: 3435
I found the solution. https://github.com/yiisoft/yii/issues/1385 this hack helps with simple selects and indexes.
Upvotes: 2
Reputation: 6726
It's impossible to do for AR. You should rewrite your code to DAO.
Upvotes: 0