You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to understand if it is possible to get add related resources to response.
I do a request to the API to get messages, the response contains an array of the user that it posted id. simple example:
{
"id": "36f23f2bc90d35f0",
"created": "2020-06-24T09:27:40.217+00:00",
"body": "This is a message",
"user": {
"id": 1,
"name": "jan",
"email": "test@test.com"
}
}
is it possible some way that the user array transforms to a User resource inside the Message Resource? At the moment when I do $this->_transformResults($query->endpoint(), $messages); it will returns a MessageResource with an array instead of user resource.
The text was updated successfully, but these errors were encountered:
Currently there's no support for associations so there's no way for the MessagesEndpoint to know that user array should be converted into User resource. You'll have to handle the conversion yourself, for e.g. in the Message resource class' constructor.
Hi,
I'm trying to understand if it is possible to get add related resources to response.
I do a request to the API to get messages, the response contains an array of the user that it posted id. simple example:
is it possible some way that the user array transforms to a User resource inside the Message Resource? At the moment when I do
$this->_transformResults($query->endpoint(), $messages);
it will returns a MessageResource with an array instead of user resource.The text was updated successfully, but these errors were encountered: