Fix notice when deleting last record#1
Conversation
When deleting the last record for a given foreign key, the $results (sum in my example) would be completely empty as there were no records to sum.
|
Notice (8): Undefined offset: 0 [APP/Model/Behavior/AggregateCacheBehavior.php, line 93] |
|
Hello? |
|
Sorry I had other changes I wanted to merge and got pulled in too many directions. I think it would be better to let each have a configurable default value instead of forcing ZERO if no values come back. Imagine that if I was trying to track the AVG of something - I would rather have it come back as NULL if no records exist than to set it as 0 which might imply records exist but just happen to average out to 0 (which might not always be the case). I will merge this pull request for now because it provides a suitable, if not always ideal, solution. If someone wants to implement the configurable defaults for each function then I'll merge that, too. |
Fix for instances where records do not exist and field value is not returned.
|
👍 agree |
When deleting the last record for a given foreign key, the $results (sum in my example) would be completely empty as there were no records to sum.