SqlDataProvider incompatibile with ActiveDataProvider?

Why does SqlDataProvider return the result as an array of arrays while ActiveDataProvider keeps it as array of objects? The approach forces using two different GridView::widget when the grid manipulates on some properties of the object/array (yep, here is the problem).

Is there any way to indicate SqlDataProvider to return a list of objects to be fully compatibile with ActiveDataProvider?

Cheers,

Andrzej

http://www.yiiframework.com/doc-2.0/guide-helper-array.html#getting-values

ArrayHelper::getValue() will be a little help, if you want to use the same code for accessing "$model" in a grid view column with ActiveDataProvider and SqlDataProvider.

As far as I know, SqlDataProvider has no means to return data as objects. It’s because, I guess, against the concept of SqlDataProvider.

When you want to use SqlDataProvider, it’s probably because you want SPEED. And conversion from array to object requires considerable time (that’s what ActiveDataProvider does).

Thanks for the help. Actually ArrayHelper::getValue() is some way to achieve the compromise (I implemented it). Nevertheless during my trip through the Yii framework code I noticed yii\db\Command::$fetchMode property set to \PDO::FETCH_ASSOC. Changing the property to \PDO::FETCH_CLASS and making some changes within the methods to service the results probabably could solve the problem of incompatibility. Just want to say there is an open way to get the compatibility done.

Very interesting.