sanchezzzhak / kak-clickhouse

Yii2 ext. ClickHouse
69 stars 43 forks source link

Incorrect response on ActiveRecord->count() #7

Closed rowdyroad closed 7 years ago

rowdyroad commented 7 years ago

Hi, again.

I've found this issue when working with ActiveRestController.

Index action makes count(*) query (for pagination). So, your component return an array not scalar int value.

Little Example: class Measuring extends \yii\db\ActiveRecord class MeasuringReport extends \kak\clickhouse\ActiveRecord

var_dump(\app\models\Measuring::find()->count()); var_dump(\app\models\MeasuringReport::find()->count()); Response is:

int(4308936) array(1) { [0]=> array(1) { ["COUNT()"]=> string(7) "4308936" } }

Now I'm thinking about way to fix it, we can think together))

sanchezzzhak commented 7 years ago

Hi, yes this is error ( I don't use ActiveRecord, just DAO, but interested to fix it up

sanchezzzhak commented 7 years ago

Tnx

rowdyroad commented 7 years ago

без проблем ;)