Jump to content

Recommended Posts

Posted

What does everyone think of this? Shouldn't they both return NullPage?

image.png.e51eb94461b281731623bf114cb90c12.png

 

I'd love to hear your thoughts. Thanks!

Posted

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?

  • Like 1
Posted
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

Posted

You are right: $categories returns a PageArray, so I thought that get() should return a NullPage in both cases.

Posted

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
Posted

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

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
  • Recently Browsing   0 members

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