From 42f35b93842216615dfcb2ed49321c6e06f86d33 Mon Sep 17 00:00:00 2001 From: Mario Baggio Date: Fri, 5 Jan 2018 12:41:55 -0300 Subject: [PATCH] TwitterAds bugfixes on 2.0.0 --- src/TwitterAds.php | 3 ++- src/TwitterAds/Cursor.php | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/TwitterAds.php b/src/TwitterAds.php index d9a7f82..49a7359 100644 --- a/src/TwitterAds.php +++ b/src/TwitterAds.php @@ -116,7 +116,8 @@ public static function init($consumerKey, $consumerSecret, $oauthToken = '', $oa */ public function getAccounts() { - return (new Account($this))->all(); + // First param should be null (or $this->accountId?) + return (new Account(null, $this))->all(); } /** diff --git a/src/TwitterAds/Cursor.php b/src/TwitterAds/Cursor.php index f82d3e9..3f475d5 100644 --- a/src/TwitterAds/Cursor.php +++ b/src/TwitterAds/Cursor.php @@ -143,7 +143,10 @@ public function fromResponse($request) foreach ($request->data as $item) { if (method_exists($this->resource, 'fromResponse')) { /** @var \Hborras\TwitterAdsSDK\TwitterAds\Resource $obj */ - $obj = new $this->resource(); + + // New Resource needs at least $this->twitterAds + $obj = new $this->resource(null, $this->twitterAds); + $this->collection[] = $obj->fromResponse($item); } else { $this->collection[] = $item;