Skip to content

Fix notice when deleting last record#1

Merged
cwbit merged 1 commit intocwbit:masterfrom
Ali1:master
Apr 21, 2014
Merged

Fix notice when deleting last record#1
cwbit merged 1 commit intocwbit:masterfrom
Ali1:master

Conversation

@Ali1
Copy link
Copy Markdown
Contributor

@Ali1 Ali1 commented Mar 30, 2014

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.

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.
@Ali1
Copy link
Copy Markdown
Contributor Author

Ali1 commented Mar 30, 2014

Notice (8): Undefined offset: 0 [APP/Model/Behavior/AggregateCacheBehavior.php, line 93]

@cwbit cwbit added the bug label Mar 30, 2014
@Ali1
Copy link
Copy Markdown
Contributor Author

Ali1 commented Apr 19, 2014

Hello?

@cwbit
Copy link
Copy Markdown
Owner

cwbit commented Apr 21, 2014

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.

cwbit added a commit that referenced this pull request Apr 21, 2014
Fix for instances where records do not exist and field value is not returned.
@cwbit cwbit merged commit 9145282 into cwbit:master Apr 21, 2014
@Ali1
Copy link
Copy Markdown
Contributor Author

Ali1 commented Apr 21, 2014

👍 agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants