Minor clean-up of the DocumentRepository

None of these changes are essential, but I spotted room for improvement (in my opinion) when was looking through the repository code. Each commit has a single change in decreasing order of importance:

1. In `findAll()` it is more efficient to return the array directly from the query object rather than looping through the result after the fact.
2. Avoid an unnecessary function call in a small number of cases (changed on principle).
3. Since the `$ids` array has the proper format for calling `array_intersect` directly using `call_user_func_array` the use of a _for-loop_ seemed superfluous.