yii\db\QueryInterface::indexBy PHP Method

indexBy() public method

Sets the [[indexBy]] property.
public indexBy ( string | callable $column )
$column string | callable the name of the column by which the query results should be indexed by. This can also be a callable (e.g. anonymous function) that returns the index value based on the given row data. The signature of the callable should be: ```php function ($row) { // return the index value corresponding to $row } ```
    public function indexBy($column);