Skip to content

Commit ded41dd

Browse files
committed
Put back in FacebookResponse methods and deprecate them instead of removing them
Update changelog
1 parent 63caaa2 commit ded41dd

File tree

2 files changed

+96
-2
lines changed

2 files changed

+96
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@
1515
- `GraphExperience`
1616
- `GraphInsightsRangeValue`
1717
- `GraphMailingAddress`
18+
- `GraphPaymentPricePoint`
19+
- `GraphPaymentPricePoints`
20+
- `GraphPermission`
1821
- `GraphPhoto`
1922
- `GraphPlace`
2023
- `GraphPlatformImageSource`
2124
- `GraphVideo`
2225
- `GraphVideoFormat`
26+
- `GraphVideoUploadLimits`
2327
- Removed integration tests as Facebook's API does not support it anymore anyway.
2428
- Deleted the entire `docs` folder as it's too much work to maintain and was full of outdated examples. For
2529
documentation, see https://developers.facebook.com/docs/graph-api.
@@ -75,15 +79,15 @@
7579
- `GraphAchievement`:
7680
- Removed entirely. See https://developers.facebook.com/docs/graph-api/reference/user/achievements.
7781
- `FacebookResponse`:
78-
- Removed these type-casting methods. Use `getGraphNode(<class>)` instead. This is similar to the changes made to
82+
- Deprecated these type-casting methods. Use `getGraphNode(<class>)` instead. This is similar to the changes made to
7983
`GraphNodeFactory` for the same reason.
80-
- `getGraphAchivement()`
8184
- `getGraphAlbum()`
8285
- `getGraphPage()`
8386
- `getGraphSessionInfo()`
8487
- `getGraphUser()`
8588
- `getGraphEvent()`
8689
- `getGraphGroup()`
90+
- Removed `getGraphAchivement()`
8791

8892
## 7.x (UNOFFICIAL)
8993

src/Facebook/FacebookResponse.php

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,17 @@
2424

2525
namespace Facebook;
2626

27+
use Facebook\GraphNodes\GraphAlbum;
2728
use Facebook\GraphNodes\GraphEdge;
29+
use Facebook\GraphNodes\GraphEvent;
30+
use Facebook\GraphNodes\GraphGroup;
2831
use Facebook\GraphNodes\GraphNode;
2932
use Facebook\GraphNodes\GraphNodeFactory;
3033
use Facebook\Exceptions\FacebookResponseException;
3134
use Facebook\Exceptions\FacebookSDKException;
35+
use Facebook\GraphNodes\GraphPage;
36+
use Facebook\GraphNodes\GraphSessionInfo;
37+
use Facebook\GraphNodes\GraphUser;
3238

3339
/**
3440
* Class FacebookResponse
@@ -247,6 +253,90 @@ public function getGraphNode(?string $subclassName = null): GraphNode
247253
return $factory->makeGraphNode($subclassName);
248254
}
249255

256+
/**
257+
* Convenience method for creating a GraphAlbum collection.
258+
* @throws FacebookSDKException
259+
* @deprecated Use getGraphNode(GraphAlbum::class).
260+
*/
261+
public function getGraphAlbum(): GraphAlbum
262+
{
263+
$factory = new GraphNodeFactory($this);
264+
265+
/** @var GraphAlbum $album */
266+
$album = $factory->makeGraphNode(GraphAlbum::class);
267+
return $album;
268+
}
269+
270+
/**
271+
* Convenience method for creating a GraphPage collection.
272+
* @throws FacebookSDKException
273+
* @deprecated Use getGraphNode(GraphPage::class)).
274+
*/
275+
public function getGraphPage(): GraphPage
276+
{
277+
$factory = new GraphNodeFactory($this);
278+
279+
/** @var GraphPage $page */
280+
$page = $factory->makeGraphNode(GraphPage::class);
281+
return $page;
282+
}
283+
284+
/**
285+
* Convenience method for creating a GraphSessionInfo collection.
286+
* @throws FacebookSDKException
287+
* @deprecated Use getGraphNode(GraphSessionInfo::class).
288+
*/
289+
public function getGraphSessionInfo(): GraphSessionInfo
290+
{
291+
$factory = new GraphNodeFactory($this);
292+
293+
/** @var GraphSessionInfo $session */
294+
$session = $factory->makeGraphNode(GraphSessionInfo::class);
295+
return $session;
296+
}
297+
298+
/**
299+
* Convenience method for creating a GraphUser collection.
300+
* @throws FacebookSDKException
301+
* @deprecated Use getGraphNode(GraphUser::class).
302+
*/
303+
public function getGraphUser(): GraphUser
304+
{
305+
$factory = new GraphNodeFactory($this);
306+
307+
/** @var GraphUser $user */
308+
$user = $factory->makeGraphNode(GraphUser::class);
309+
return $user;
310+
}
311+
312+
/**
313+
* Convenience method for creating a GraphEvent collection.
314+
* @throws FacebookSDKException
315+
* @deprecated Use getGraphNode(GraphEvent::class).
316+
*/
317+
public function getGraphEvent(): GraphEvent
318+
{
319+
$factory = new GraphNodeFactory($this);
320+
321+
/** @var GraphEvent $event */
322+
$event = $factory->makeGraphNode(GraphEvent::class);
323+
return $event;
324+
}
325+
326+
/**
327+
* Convenience method for creating a GraphGroup collection.
328+
* @throws FacebookSDKException
329+
* @deprecated Use getGraphNode(GraphGroup::class).
330+
*/
331+
public function getGraphGroup(): GraphGroup
332+
{
333+
$factory = new GraphNodeFactory($this);
334+
335+
/** @var GraphGroup $group */
336+
$group = $factory->makeGraphNode(GraphGroup::class);
337+
return $group;
338+
}
339+
250340
/**
251341
* Instantiate a new GraphEdge from response.
252342
*

0 commit comments

Comments
 (0)