-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix loose of information when GraphNode convertion #817
Conversation
I miss something wait please |
That's good now |
Not sure about this solution... I'll investigate when I have some time. |
I am just thinking about that but I need to test nested request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tolbon for this PR! Can you please rebase it and apply those small fixes? Could you also update the changelog file? Thanks
@@ -303,8 +303,10 @@ public function castAsGraphNodeOrGraphEdge(array $data, $subclassName = null, $p | |||
if (static::isCastableAsGraphEdge($data['data'])) { | |||
return $this->safelyMakeGraphEdge($data, $subclassName, $parentKey, $parentNodeId); | |||
} | |||
if (count($data) === 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a line above to separate if
's
@@ -303,8 +303,10 @@ public function castAsGraphNodeOrGraphEdge(array $data, $subclassName = null, $p | |||
if (static::isCastableAsGraphEdge($data['data'])) { | |||
return $this->safelyMakeGraphEdge($data, $subclassName, $parentKey, $parentNodeId); | |||
} | |||
if (count($data) === 1) { | |||
// Sometimes Graph is a weirdo and returns a GraphNode under the "data" key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this comment above the if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a test covering this case so we avoid any future regression? thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tolbon can you update this PR? I'm about to tag a new release soon. Please rebase, update the changelog and add tests.
I'd test 2 cases: one with only the data
key, and one with data
and other fields.
This pull request now says
I've googled it and it sounds like the branch was deleted on the fork. There also hasn't been a reply from them in over a year. I'll open a duplicate PR with @tolbon's fix and my test from #1034. |
@foaly-nr1 If you can do this very helpfull, thanks. |
I've created a duplicate of this PR under #1085. The tests fail so this is not a fix for #700.
I suggest to reconsider #1034 which offers a solution. |
ok I remember test with that {
"id": "123456",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://scontent.xx.fbcdn.net/p50x50/foo.jpg"
}
}
} yours is certainly better and resolve more case 👍 |
@foaly-nr1 thanks! How I see the fix, to be generic and don't destructure the Graph response:
|
@foaly-nr1 @tolbon what do you think about this? :) |
It's ok for me @foaly-nr1 do you have true facebook call where your test is like that ? |
@foaly-nr1 good catch! It is a BC break.. I'll think about a way to fix the bug in a BC way when I have time (in fact I already have an idea that I need to confirm, but in France it's time to sleep). Meanwhile, any proposal to achieve that result? :) |
|
fixes #700
Maybe a patch to this issue #700