-
Notifications
You must be signed in to change notification settings - Fork 2k
Only "data" key is cast to GraphNode #700
Comments
The missing |
Hey @foaly-nr1! Yes - you've stumbled upon a bug in the overly-complex Graph-node casting. :/ We should do some digging to find out what's causing this, but until then, a workaround is to bypass the GraphEdges & GraphNodes and just access the array directly with $res = $fb->get('/{pageId}/ratings?fields=open_graph_story', $accessToken);
$ratings = $res->getDecodedBody();
foreach ($ratings['data'] as $rating) {
var_dump($rating['open_graph_story']['id']);
} I hope that helps! :) |
Thanks @SammyK that's super helpful. What's causing this is that when you descent through the nodes to cast them, you either cast the full node or when there is a "data" key, you cast the "data" key instead. So any structure that has information on the same level as a data key will lead to this information being lost. Example:
|
Hey @foaly-nr1! Good call. I think this is the problem right here. :) |
@yguedidi Yes, when grabbing a user's profile picture for example: {
"id": "123456",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://scontent.xx.fbcdn.net/p50x50/foo.jpg"
}
}
} |
Ok I test tomorrow but my "patch" seems to be ok |
@tolbon can you create a PR please? |
@foaly-nr1 Yep tomorrow after my test :) |
This will be fixed soon, finally! :) |
Conserve id when next to data key, resolves #700
Uh oh!
There was an error while loading. Please reload this page.
I'm retrieving a page's ratings including their id by requesting:
/v2.8/*PAGE_ID*/ratings?fields=open_graph_story
. The response has the following format:Each object in the
data
array has a keyid
that contains the review's story id. However, it is dropped when the reviews are casted intoGraphNode
objects:Responsible is this:
Graph is being a weirdo and doesn't include all information under the
data
key.The text was updated successfully, but these errors were encountered: