rexlabsio / smokescreen-laravel-php

Library for integrating the Smokescreen transformation library with the Laravel framework
MIT License
4 stars 1 forks source link

Resolve to empty transformer when result set is empty #4

Closed rhysemmerson closed 6 years ago

rhysemmerson commented 6 years ago
Smokescreen::transform(Integration::paginate());

Will throw UnresolvedTransformerException if the result set is empty.

Smokescreen introspects the first item to determine the Model, but this fails if the set is empty.

My solution is to add EmptyTransformer to handle the empty case.