examples/AdWords/v201809/AdvancedOperations/AddUniversalAppCampaign.php
private static function createBudget(
        AdWordsServices $adWordsServices,
        AdWordsSession $session
    ) {
        $budgetService = $adWordsServices->get($session, BudgetService::class);

        // Create the shared budget (required).
        $budget = new Budget();
        $budget->setName('Interplanetary Cruise Budget #' . uniqid());
        $money = new Money();
        $money->setMicroAmount(50000000);
        $budget->setAmount($money);
        $budget->setDeliveryMethod(BudgetBudgetDeliveryMethod::STANDARD);

        // Universal App campaigns don't support shared budgets.
        $budget->setIsExplicitlyShared(false);
        $operations = [];

        // Create a budget operation.
        $operation = new BudgetOperation();
        $operation->setOperand($budget);
        $operation->setOperator(Operator::ADD);
        $operations[] = $operation;

        // Create the budget on the server.
        $result = $budgetService->mutate($operations);
        $budget = $result->getValue()[0];

        printf(
            "Budget with name '%s' and ID %d was created.\n",
            $budget->getName(),
            $budget->getBudgetId()
        );


        return $budget->getBudgetId();
    }
private static function createBudget(
        AdWordsServices $adWordsServices,
        AdWordsSession $session
    ) {
        $budgetService = $adWordsServices->get($session, BudgetService::class);

        // Create the shared budget (required).
        $budget = new Budget();
        $budget->setName('Interplanetary Cruise Budget #' . uniqid());
        $money = new Money();
        $money->setMicroAmount(50000000);
        $budget->setAmount($money);
        $budget->setDeliveryMethod(BudgetBudgetDeliveryMethod::STANDARD);

        // Universal App campaigns don't support shared budgets.
        $budget->setIsExplicitlyShared(false);
        $operations = [];

        // Create a budget operation.
        $operation = new BudgetOperation();
        $operation->setOperand($budget);
        $operation->setOperator(Operator::ADD);
        $operations[] = $operation;

        // Create the budget on the server.
        $result = $budgetService->mutate($operations);
        $budget = $result->getValue()[0];

        printf(
            "Budget with name '%s' and ID %d was created.\n",
            $budget->getName(),
            $budget->getBudgetId()
        );


        return $budget->getBudgetId();
    }
private static function createBudget ( AdWordsServices $ adWordsServices , AdWordsSession $ session ) { $ budgetService = $ adWordsServices -> get ( $ session , BudgetService :: class ) ; // Create the shared budget (required). $ budget = new Budget ( ) ; $ budget -> setName ( 'Interplanetary Cruise Budget #' . uniqid ( ) ) ; $ money = new Money ( ) ; $ money -> setMicroAmount ( 50000000 ) ; $ budget -> setAmount ( $ money ) ; $ budget -> setDeliveryMethod ( BudgetBudgetDeliveryMethod :: STANDARD ) ; // Universal App campaigns don't support shared budgets. $ budget -> setIsExplicitlyShared ( false ) ; $ operations = [ ] ; // Create a budget operation. $ operation = new BudgetOperation ( ) ; $ operation -> setOperand ( $ budget ) ; $ operation -> setOperator ( Operator :: ADD ) ; $ operations [ ] = $ operation ; // Create the budget on the server. $ result = $ budgetService -> mutate ( $ operations ) ; $ budget = $ result -> getValue ( ) [ 0 ] ; printf ( "Budget with name '%s' and ID %d was created.\n" , $ budget -> getName ( ) , $ budget -> getBudgetId ( ) ) ; return $ budget -> getBudgetId ( ) ; }
Creates the budget for the campaign.
Creates the budget for the campaign .