Jump to content

DB vs in memory selectors - null vs NullPage


adrian
 Share

Recommended Posts

2 minutes ago, Lutz said:

get() should return a NullPage in both cases, if $categories returns a PageArray. Since find() could return a PageArray or an array: what does $categories return?

Thanks for chiming in! Here are some more outputs which I think help to back up the assertion that it should return a NullPage

image.png.efc353eb20946ce6a89a1b01caf8a453.png

Link to comment
Share on other sites

Have you had a look at PageArray.php?

W8fx33X.png

And in WireArray.php:

ueMG7n9.png

Not sure if it should return a NullPage or null/false - but I guess it should be consistent...

To add one more: findOne() returns "false" ? 

RyZqMpX.png

 

  • Like 1
Link to comment
Share on other sites

I hadn't looked - thanks for posting that - it's pretty clear from that @todo that Ryan know about this and that it needs fixing. Obviously calling findOne() if it's a selector isn't enough to get it to return NullPage as things currently stand, but this really should be fixed because with the current behavior you can't simply do a normal:

if($result->id)

on an in memory selector that returns no results because of the null vs NullPage - this has annoyed me for a long time ?

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...