-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add meta per item in a collection #354
Comments
You can add a |
You're right, that's exactly what I'm trying to avoid here :) |
Sorry for the late response - have you found a solution yet? Eventually, this approach may help you.. protected $defaultIncludes = ['meta']; within your transformer.. Then implement respective method: public function includeMeta(Object $object) {
$meta = $object->getMeta();
return $this->item($meta, new MetaTransformer());
} Of course, you would need to implement the Using the Maybe this helps!? Obviously not the best solution, but eventually you can tackle your requirements?! |
That would still append the inner result in the data object, right? |
Honestly - I don't know.. I would say, it depends on the This serializer would create a Unfortunately, I am not aware, how other serializers will handle this. You will need to try it out on your own, i guess... |
Using the DataArraySerializer.. How about this comment by @jasonlewis about having a meta() method #18 ? |
Hi im following this issue as i'm currently trying to figure out i solution to this. Im working on a function that returns User Follow requests which can have different statusses (pending, accepted, etc). Ideally when doing a call to /user/{id}/followers we'd like to have a JSON output like: {
"data": [
{"data" : {USEROBJECT1}, "meta" : {USEROBJECT_META1}},
{"data" : {USEROBJECT2}, "meta" : {USEROBJECT_META2}},
{"data" : {USEROBJECT3}, "meta" : {USEROBJECT_META3}},
]
} As far as i know currently its only possible the set the Meta for the whole collection, Are there any plans for this functionality in the future? |
I'm working on a solution for this. I should have a PR up shortly. |
Using the setMeta function it's possible to set metadata for an entire collection,
However, I'd like to be able to set additional metadata per item in the collection. Would be nice if this could be done in the CategoryTransformer by using a
$this->setMeta()
method on the transformer to add meta for the item (?)Any thoughts on this? Is it already possible someway?
The text was updated successfully, but these errors were encountered: