tmarois / laravel-ads-sdk

PHP SDK for Google Ads, Bing Ads, and Facebook Ads API for Laravel
MIT License
110 stars 42 forks source link

Bing Campaigns broken #27

Closed maxSupermoney closed 3 years ago

maxSupermoney commented 3 years ago

Bing campaigns seem to have broken in commit a37638c35a27b7e51e96162dab554d4814c819c2

Many of the Operation class methods were removed from CampaignOperations, and it does not extend the Operation class like AdGroupOperations so now there are missing methods.

Can we just extend the Operation class like AdGroupOperations does?

Trace

   Symfony\Component\Debug\Exception\FatalThrowableError  : Call to undefined method LaravelAds\Services\BingAds\Operations\Campaign::set()

  at /var/www/vhost/ad-data-gatherers/vendor/tmarois/laravel-ads-sdk/src/Services/BingAds/Service.php:196
    192|      */
    193|     public function campaign($campaign)
    194|     {
    195|         if ($campaign instanceof \stdClass) {
  > 196|             return (new Campaign($this))->set($campaign);
    197|         }
    198|
    199|         return (new Campaign($this))->setId($campaign)->get();
    200|     }

  Exception trace:

  1   LaravelAds\Services\BingAds\Service::campaign(Object(stdClass))
      /var/www/vhost/ad-data-gatherers/vendor/tmarois/laravel-ads-sdk/src/Services/BingAds/Fetch.php:59
timothymarois commented 3 years ago

Thanks for bringing that up, I believe that's an unreleased commit, maybe something @modernben can take a look at? I haven't had a chance to look over all the changes yet.

modernben commented 3 years ago

Yep, that was definitely my bad. That campaign operation class should extend another class called Operation. I'll submit a patch shortly.