mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-14 06:11:35 +08:00
Added edge case handling to aggregation example in docs [skip ci]
See https://github.com/yiisoft/yii2/issues/12491#issuecomment-276593948
This commit is contained in:
@ -1625,7 +1625,7 @@ class Customer extends \yii\db\ActiveRecord
|
||||
return null; // this avoid calling a query searching for null primary keys
|
||||
}
|
||||
|
||||
return $this->ordersAggregation[0]['counted'];
|
||||
return empty($this->ordersAggregation) ? 0 : $this->ordersAggregation[0]['counted'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user