examples/AdWords/v201809/CampaignManagement/AddCompleteCampaignsUsingBatchJob.php
private static function buildAdGroupAdOperations(array $adGroupOperations)
    {
        $operations = [];
        foreach ($adGroupOperations as $adGroupOperation) {
            $adGroupId = $adGroupOperation->getOperand()->getId();
            $adGroupAd = new AdGroupAd();
            $adGroupAd->setAdGroupId($adGroupId);

            $expandedTextAd = new ExpandedTextAd();
            $expandedTextAd->setHeadlinePart1('Luxury Cruise to Mars');
            $expandedTextAd->setHeadlinePart2('Visit the Red Planet in style.');
            $expandedTextAd->setDescription('Low-gravity fun for everyone!');
            $expandedTextAd->setFinalUrls(['http://www.example.com/1']);

            $adGroupAd->setAd($expandedTextAd);

            $operation = new AdGroupAdOperation();
            $operation->setOperator(Operator::ADD);
            $operation->setOperand($adGroupAd);

            $operations[] = $operation;
        }

        return $operations;
    }
private static function buildAdGroupAdOperations(array $adGroupOperations)
    {
        $operations = [];
        foreach ($adGroupOperations as $adGroupOperation) {
            $adGroupId = $adGroupOperation->getOperand()->getId();
            $adGroupAd = new AdGroupAd();
            $adGroupAd->setAdGroupId($adGroupId);

            $expandedTextAd = new ExpandedTextAd();
            $expandedTextAd->setHeadlinePart1('Luxury Cruise to Mars');
            $expandedTextAd->setHeadlinePart2('Visit the Red Planet in style.');
            $expandedTextAd->setDescription('Low-gravity fun for everyone!');
            $expandedTextAd->setFinalUrls(['http://www.example.com/1']);

            $adGroupAd->setAd($expandedTextAd);

            $operation = new AdGroupAdOperation();
            $operation->setOperator(Operator::ADD);
            $operation->setOperand($adGroupAd);

            $operations[] = $operation;
        }

        return $operations;
    }
private static function buildAdGroupAdOperations ( array $ adGroupOperations ) { $ operations = [ ] ; foreach ( $ adGroupOperations as $ adGroupOperation ) { $ adGroupId = $ adGroupOperation -> getOperand ( ) -> getId ( ) ; $ adGroupAd = new AdGroupAd ( ) ; $ adGroupAd -> setAdGroupId ( $ adGroupId ) ; $ expandedTextAd = new ExpandedTextAd ( ) ; $ expandedTextAd -> setHeadlinePart1 ( 'Luxury Cruise to Mars' ) ; $ expandedTextAd -> setHeadlinePart2 ( 'Visit the Red Planet in style.' ) ; $ expandedTextAd -> setDescription ( 'Low-gravity fun for everyone!' ) ; $ expandedTextAd -> setFinalUrls ( [ 'http://www.example.com/1' ] ) ; $ adGroupAd -> setAd ( $ expandedTextAd ) ; $ operation = new AdGroupAdOperation ( ) ; $ operation -> setOperator ( Operator :: ADD ) ; $ operation -> setOperand ( $ adGroupAd ) ; $ operations [ ] = $ operation ; } return $ operations ; }
Builds objects of AdGroupAdOperation for creating an ad group ad for
ad groups in the specified ad group operations.

@param AdGroupOperation[] $adGroupOperations an array of AdGroupOperation
@return array an array of AdGroupAdOperation
Builds objects of AdGroupAdOperation for creating an ad group ad for ad groups in the specified ad group operations .