dingo/api

Missing setTransformer in Factory class

rleger opened this issue · 1 comments

I'd like to use the (nested) include feature from Fractal, I can't register the transformer in a service provider like described in the docs (below) transformer documentation because the setTransformer does not exist on the Factory class. I use laravel 5.1.

$this->app['Dingo\Api\Transformer\Factory']->setTransformer(function ($app) {
     return new Dingo\Api\Transformer\Adapter\Fractal(new League\Fractal\Manager, 'include', ',');
});

The include function works out of the box for simple includes, but I can't get nested includes to work properly like they do in fractal.

When I want to return a collection with nested relations I only get 'first level' includes, after that I get an empty array.

When I return an item, It works perfectly with nested includes.

I thought registering the transformer might help, which is how I came to that !!

Thanks very much for your help.

Docs need to be updated, it's setAdapter and not setTransformer. Thanks for pointing this out.