Controllers have loadHandles() and loadViewerHandles(), neither of which work quite right:
- loadViewerHandles() has a convenient signature but causes more loads than necessary;
- loadHandles() has good data fetching semantics but an inconvenient signature.
They are also both bound to Controllers, which is an awkward place to coordinate handle loads.
Instead, we can provide a:
$handles = $viewer->loadHandles($phids);
...which returns an ArrayAccess / Iterator object that doesn't actually load the handles. When something accesses the handles, we can actually do the fetch.
This should improve caching and batching while providing desirable semantics, and improve coordination by letting callers coordinate on the Viewer (which is always available and reasonably the correct object to perform this coordination with) instead of the Controller.