Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing setTransformer in Factory class #672

Closed
rleger opened this issue Oct 1, 2015 · 1 comment
Closed

Missing setTransformer in Factory class #672

rleger opened this issue Oct 1, 2015 · 1 comment

Comments

@rleger
Copy link

rleger commented Oct 1, 2015

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.

@jasonlewis
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants