facebook / facebook-php-business-sdk

PHP SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
833 stars 516 forks source link

Campaign Budget - Error Undefined class constant 'DAILY_BUDGET' #489

Closed DeepakTiwari84 closed 6 years ago

DeepakTiwari84 commented 6 years ago

Hi,

I am trying to create Campaign with "DAILY_BUDGET" , but I am getting error as

Error Undefined class constant 'DAILY_BUDGET'

I checked the CampaignFields.php , the file has DAILY_BUDGET listed under the fields . Here is the code I am using for placing campaign

   try{
         $campaign = new Campaign();
          $campaign->setParentId('act_myaccountid');
            $campaign->setData(array(
                CampaignFields::NAME => "Test Campaign Budget",
                CampaignFields::OBJECTIVE => 'LINK_CLICKS',
                CampaignFields::DAILY_BUDGET => '300',
            ));
            $campaign->validate()->create(array(
                Campaign::STATUS_PARAM_NAME => Campaign::STATUS_ACTIVE,
            ));
            echo  $campaign->id;
        }
      catch (Exception $e) {
                    \Log::info($e);
          }
DeepakTiwari84 commented 6 years ago

Sorry , I updated the SDK and it worked