processwire / processwire-requests

ProcessWire feature requests.
39 stars 0 forks source link

New findOneID() method #394

Open adrianbj opened 3 years ago

adrianbj commented 3 years ago

Short description of the enhancement

Could we please have a findOneID() that works like getID() / has() except that it respects exclusions ?

Current vs. suggested behavior

Currently you can't use getID() or has() to actually check if a page exists and is published, not hidden, not trashed, so it's not that useful in most scenarios. The idea behind has() (if I am correct) was to provide a very performant way to know if there are any results for a selector - faster than count() which many of us have used for this purpose. But when it doesn't respect exclusions, it really doesn't work like count().

Why would the enhancement be useful to users?

More details here: https://processwire.com/talk/topic/25237-pages-has-with-exclusions-or-maybe-a-findoneid/?tab=comments#comment-211902

Thanks for considering.