This repository was archived by the owner on Jan 13, 2022. It is now read-only.
This repository was archived by the owner on Jan 13, 2022. It is now read-only.
Field mapping for edges #435
Closed
Description
As we think about how we're going to support "non-root node thingies" in #401, it'd be nice to also include support for auto-casting of nodes returned from an edge.
We could reference the edge just as we do with fields and define how to cast each node from that edge.
class GraphEvent extends GraphNode
{
protected static $graphObjectMap = [
// Normal field
'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
// Edge with all of the same subtypes returned
'photos' => '\Facebook\GraphNodes\GraphPhoto',
];
// . . .
}
The SDK already has support for casting edge subtypes so it would just require getting the $graphObjectMap
feature to support it.
Metadata
Metadata
Assignees
Labels
No labels