Strange problem here. Wondering if anybody else encountered anything similar.
I have an ActiveDataProvider with an ActiveQuery. The generated SQL seems to be accurate, and when I use $query->count()
to count the records, I get 272. However, if I perform $query->all()
and then count the records, I get a different number:
echo $dataProvider->query->count(); // 272
echo count($dataProvider->query->all()); // 256 (!!)
What can be going on here??
This is the ActiveDataProvider:
yii\data\ActiveDataProvider Object
(
[query] => app\models\ReservationItemQuery Object
(
[resolution] =>
[sql] =>
[on] =>
[joinWith] =>
[select] =>
[selectOption] =>
[distinct] =>
[from] =>
[groupBy] =>
[join] => Array
(
[0] => Array
(
[0] => INNER JOIN
[1] => reservation
[2] => reservation.id = reservation_item.reservation_id
)
[1] => Array
(
[0] => INNER JOIN
[1] => user
[2] => user.id = reservation.user_id
)
[2] => Array
(
[0] => LEFT JOIN
[1] => reservation_team
[2] => reservation_team.reservation_item_id = reservation_item.id
)
)
[having] =>
[union] =>
[params] => Array
(
)
[_events:yii\base\Component:private] => Array
(
)
[_behaviors:yii\base\Component:private] => Array
(
)
[where] => Array
(
[0] => and
[1] => Array
(
[{{%reservation_item}}.event_id] => 37
[{{%reservation_item}}.status] => 1
)
[2] => Array
(
[0] => =
[1] => {{%reservation_item}}.type
[2] => 4
)
)
[limit] => -1
[offset] =>
[orderBy] =>
[indexBy] =>
[emulateExecution] =>
[modelClass] => app\models\events\EventOptionOrder
[with] =>
[asArray] =>
[multiple] =>
[primaryModel] =>
[link] =>
[via] =>
[inverseOf] =>
)
[key] =>
[db] =>
[id] =>
[_sort:yii\data\BaseDataProvider:private] => yii\data\Sort Object
(
...
)
[_pagination:yii\data\BaseDataProvider:private] =>