examples/AdWords/v201809/AdvancedOperations/AddAdCustomizer.php
private static function createFeedItemAddOperation(
        $name,
        $price,
        $date,
        AdCustomizerFeed $adCustomizerFeed
    ) {
        $nameAttributeValue = new FeedItemAttributeValue();
        $nameAttributeValue->setFeedAttributeId(
            $adCustomizerFeed->getFeedAttributes()[0]->getId()
        );
        $nameAttributeValue->setStringValue($name);

        $priceAttributeValue = new FeedItemAttributeValue();
        $priceAttributeValue->setFeedAttributeId(
            $adCustomizerFeed->getFeedAttributes()[1]->getId()
        );
        $priceAttributeValue->setStringValue($price);

        $dateAttributeValue = new FeedItemAttributeValue();
        $dateAttributeValue->setFeedAttributeId(
            $adCustomizerFeed->getFeedAttributes()[2]->getId()
        );
        $dateAttributeValue->setStringValue($date);

        $item = new FeedItem();
        $item->setFeedId($adCustomizerFeed->getFeedId());
        $item->setAttributeValues(
            [$nameAttributeValue, $priceAttributeValue, $dateAttributeValue]
        );

        $operation = new FeedItemOperation();
        $operation->setOperand($item);
        $operation->setOperator('ADD');

        return $operation;
    }
private static function createFeedItemAddOperation(
        $name,
        $price,
        $date,
        AdCustomizerFeed $adCustomizerFeed
    ) {
        $nameAttributeValue = new FeedItemAttributeValue();
        $nameAttributeValue->setFeedAttributeId(
            $adCustomizerFeed->getFeedAttributes()[0]->getId()
        );
        $nameAttributeValue->setStringValue($name);

        $priceAttributeValue = new FeedItemAttributeValue();
        $priceAttributeValue->setFeedAttributeId(
            $adCustomizerFeed->getFeedAttributes()[1]->getId()
        );
        $priceAttributeValue->setStringValue($price);

        $dateAttributeValue = new FeedItemAttributeValue();
        $dateAttributeValue->setFeedAttributeId(
            $adCustomizerFeed->getFeedAttributes()[2]->getId()
        );
        $dateAttributeValue->setStringValue($date);

        $item = new FeedItem();
        $item->setFeedId($adCustomizerFeed->getFeedId());
        $item->setAttributeValues(
            [$nameAttributeValue, $priceAttributeValue, $dateAttributeValue]
        );

        $operation = new FeedItemOperation();
        $operation->setOperand($item);
        $operation->setOperator('ADD');

        return $operation;
    }
private static function createFeedItemAddOperation ( $ name , $ price , $ date , AdCustomizerFeed $ adCustomizerFeed ) { $ nameAttributeValue = new FeedItemAttributeValue ( ) ; $ nameAttributeValue -> setFeedAttributeId ( $ adCustomizerFeed -> getFeedAttributes ( ) [ 0 ] -> getId ( ) ) ; $ nameAttributeValue -> setStringValue ( $ name ) ; $ priceAttributeValue = new FeedItemAttributeValue ( ) ; $ priceAttributeValue -> setFeedAttributeId ( $ adCustomizerFeed -> getFeedAttributes ( ) [ 1 ] -> getId ( ) ) ; $ priceAttributeValue -> setStringValue ( $ price ) ; $ dateAttributeValue = new FeedItemAttributeValue ( ) ; $ dateAttributeValue -> setFeedAttributeId ( $ adCustomizerFeed -> getFeedAttributes ( ) [ 2 ] -> getId ( ) ) ; $ dateAttributeValue -> setStringValue ( $ date ) ; $ item = new FeedItem ( ) ; $ item -> setFeedId ( $ adCustomizerFeed -> getFeedId ( ) ) ; $ item -> setAttributeValues ( [ $ nameAttributeValue , $ priceAttributeValue , $ dateAttributeValue ] ) ; $ operation = new FeedItemOperation ( ) ; $ operation -> setOperand ( $ item ) ; $ operation -> setOperator ( 'ADD' ) ; return $ operation ; }
Creates a feed item operation that will create a feed item with the
specified values and ad group target when sent to FeedItemService.mutate.

@param string $name the value for the name attribute of the feed item
@param string $price the value for the price attribute of the feed item
@param string $date the value for the date attribute of the feed item
@param AdCustomizerFeed $adCustomizerFeed the customizer feed
@return FeedItemOperation the feed item operation
Creates a feed item operation that will create a feed item with the specified values and ad group target when sent to FeedItemService . mutate .