dingo / dingo/api

setSerializer() not working on collection

Open
#1,306 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
9.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

i want to remove "data" from json. so i need to set ArraySerializer.

It's working fine with **item**.
return $this->response->item($user, new UserTransformer, function ($resource, $fractal) {
$fractal->setSerializer(new ArraySerializer);
});

but not working with **collection**

return $this->response->collection($users, new UserTransformer, function ($resource, $fractal) {
$fractal->setSerializer(new ArraySerializer);
});

Reference: https://github.com/dingo/api/wiki/Transformers#utilizing-the-callback

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.