Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal error invoking find()->last() on empty table. #6683

Closed
caBBAlainB opened this issue May 30, 2015 · 2 comments
Closed

Internal error invoking find()->last() on empty table. #6683

caBBAlainB opened this issue May 30, 2015 · 2 comments
Assignees
Milestone

Comments

@caBBAlainB
Copy link

Hi,
Currently, find()->last() causes an Internal Error.
I discussed a bit of the subject wirth Admad who consider it as 'normal'.
I don't really agree with him.
'Internal error' means a critical situation.
But empty table is a 'normal' situation.
If there is no first record, there is no last record either.
If first() doesn't causes an Internal error, last() shouldn't cause it either.
I suggest that last() just returns null, as first() do, if we invoke it on empty table.

And if we look at this doc http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/collection_method.htm, calling FIRST or LAST on empty collection should just return null so, why to not do like that in Cake?

Regards

@ADmad ADmad added this to the 3.0.7 milestone May 30, 2015
@ADmad ADmad added the defect label May 30, 2015
@ADmad
Copy link
Member

ADmad commented May 30, 2015

I too disagree with my previous opinion 😛

@markstory markstory added the ORM label May 30, 2015
@markstory markstory self-assigned this May 30, 2015
@lorenzo lorenzo assigned lorenzo and unassigned markstory May 30, 2015
lorenzo added a commit that referenced this issue May 30, 2015
@ADmad
Copy link
Member

ADmad commented May 30, 2015

Closing as PR is opened.

@ADmad ADmad closed this as completed May 30, 2015
dakota pushed a commit that referenced this issue Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants