Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

Commit 5de90f6

Browse files
committed
Add FacebookBatchRequest factory method
1 parent 73b8b44 commit 5de90f6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Facebook/Facebook.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,27 @@ public function sendBatchRequest(array $requests, $accessToken = null, $graphVer
494494
return $this->lastResponse = $this->client->sendBatchRequest($batchRequest);
495495
}
496496

497+
/**
498+
* Instantiates an empty FacebookBatchRequest entity.
499+
*
500+
* @param AccessToken|string|null $accessToken The top-level access token. Requests with no access token
501+
* will fallback to this.
502+
* @param string|null $graphVersion The Graph API version to use.
503+
* @return FacebookBatchRequest
504+
*/
505+
public function newBatchRequest($accessToken = null, $graphVersion = null)
506+
{
507+
$accessToken = $accessToken ?: $this->defaultAccessToken;
508+
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
509+
510+
return new FacebookBatchRequest(
511+
$this->app,
512+
[],
513+
$accessToken,
514+
$graphVersion
515+
);
516+
}
517+
497518
/**
498519
* Instantiates a new FacebookRequest entity.
499520
*

0 commit comments

Comments
 (0)