Improve query modifiers API
SimantovYousoufov opened this issue · comments
Issue:
Adding modifiers to the repository current requires storing them in an intermediate array and then setting that array to overwrite all modifiers:
$modifiers = $repository->getModifiers();
// Add a modifier
$modifiers[] = function (Builder $query) { /* do some modifying */ };
// Set modifiers en masse
$repository->setModifiers($modifiers);
Proposal:
The most common use case would be served by an addModifier
method on the repository which accepts a Callable containing the modifier.
Fixed by #18