Answer the question
In order to leave comments, you need to log in
A query returning an array of ActiveRecord indexed by the primary key of the ActiveRecord (or better by the specified parameter)?
A query that returns an array of ActiveRecord indexed by the primary key of ActiveRecord (or rather, by the specified parameter) ?
Answer the question
In order to leave comments, you need to log in
CDbCriteria index property if you are talking about
www.yiiframework.com/doc/api/1.1/CDbCriteria#index...
*Or indexBy if you are talking about yii2
// return all customers in an array indexed by customer IDs
// SELECT * FROM `customer`
$customers = Customer::find()
->indexBy('id')
->all();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question