examples/AdWords/v201809/AdvancedOperations/AddDynamicPageFeed.php
private static function createFeedMapping(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        DSAFeedDetails $feedDetails
    ) {
        $feedMappingService = $adWordsServices->get($session, FeedMappingService::class);

        // Map the feed attribute IDs to the field ID constants.
        $urlFieldMapping = new AttributeFieldMapping();
        $urlFieldMapping->setFeedAttributeId(
            $feedDetails->urlAttributeId
        );
        $urlFieldMapping->setFieldId(self::DSA_PAGE_URLS_FIELD_ID);
        $labelFieldMapping = new AttributeFieldMapping();
        $labelFieldMapping->setFeedAttributeId(
            $feedDetails->labelAttributeId
        );
        $labelFieldMapping->setFieldId(self::DSA_LABEL_FIELD_ID);

        // Create the feed mapping and feed mapping operation.
        $feedMapping = new FeedMapping();
        $feedMapping->setCriterionType(self::DSA_PAGE_FEED_CRITERION_TYPE);
        $feedMapping->setFeedId($feedDetails->feedId);
        $feedMapping->setAttributeFieldMappings(
            [$urlFieldMapping, $labelFieldMapping]
        );

        $operation = new FeedMappingOperation();
        $operation->setOperand($feedMapping);
        $operation->setOperator(Operator::ADD);

        // Create the feed mapping operation on the server and print out some
        // information.
        $result = $feedMappingService->mutate([$operation]);
        $feedMapping = $result->getValue()[0];
        printf(
            "Feed mapping with ID %d and criterion type %d was saved for feed with ID %d.\n",
            $feedMapping->getFeedMappingId(),
            $feedMapping->getCriterionType(),
            $feedMapping->getFeedId()
        );
    }
private static function createFeedMapping(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        DSAFeedDetails $feedDetails
    ) {
        $feedMappingService = $adWordsServices->get($session, FeedMappingService::class);

        // Map the feed attribute IDs to the field ID constants.
        $urlFieldMapping = new AttributeFieldMapping();
        $urlFieldMapping->setFeedAttributeId(
            $feedDetails->urlAttributeId
        );
        $urlFieldMapping->setFieldId(self::DSA_PAGE_URLS_FIELD_ID);
        $labelFieldMapping = new AttributeFieldMapping();
        $labelFieldMapping->setFeedAttributeId(
            $feedDetails->labelAttributeId
        );
        $labelFieldMapping->setFieldId(self::DSA_LABEL_FIELD_ID);

        // Create the feed mapping and feed mapping operation.
        $feedMapping = new FeedMapping();
        $feedMapping->setCriterionType(self::DSA_PAGE_FEED_CRITERION_TYPE);
        $feedMapping->setFeedId($feedDetails->feedId);
        $feedMapping->setAttributeFieldMappings(
            [$urlFieldMapping, $labelFieldMapping]
        );

        $operation = new FeedMappingOperation();
        $operation->setOperand($feedMapping);
        $operation->setOperator(Operator::ADD);

        // Create the feed mapping operation on the server and print out some
        // information.
        $result = $feedMappingService->mutate([$operation]);
        $feedMapping = $result->getValue()[0];
        printf(
            "Feed mapping with ID %d and criterion type %d was saved for feed with ID %d.\n",
            $feedMapping->getFeedMappingId(),
            $feedMapping->getCriterionType(),
            $feedMapping->getFeedId()
        );
    }
private static function createFeedMapping ( AdWordsServices $ adWordsServices , AdWordsSession $ session , DSAFeedDetails $ feedDetails ) { $ feedMappingService = $ adWordsServices -> get ( $ session , FeedMappingService :: class ) ; // Map the feed attribute IDs to the field ID constants. $ urlFieldMapping = new AttributeFieldMapping ( ) ; $ urlFieldMapping -> setFeedAttributeId ( $ feedDetails -> urlAttributeId ) ; $ urlFieldMapping -> setFieldId ( self :: DSA_PAGE_URLS_FIELD_ID ) ; $ labelFieldMapping = new AttributeFieldMapping ( ) ; $ labelFieldMapping -> setFeedAttributeId ( $ feedDetails -> labelAttributeId ) ; $ labelFieldMapping -> setFieldId ( self :: DSA_LABEL_FIELD_ID ) ; // Create the feed mapping and feed mapping operation. $ feedMapping = new FeedMapping ( ) ; $ feedMapping -> setCriterionType ( self :: DSA_PAGE_FEED_CRITERION_TYPE ) ; $ feedMapping -> setFeedId ( $ feedDetails -> feedId ) ; $ feedMapping -> setAttributeFieldMappings ( [ $ urlFieldMapping , $ labelFieldMapping ] ) ; $ operation = new FeedMappingOperation ( ) ; $ operation -> setOperand ( $ feedMapping ) ; $ operation -> setOperator ( Operator :: ADD ) ; // Create the feed mapping operation on the server and print out some // information. $ result = $ feedMappingService -> mutate ( [ $ operation ] ) ; $ feedMapping = $ result -> getValue ( ) [ 0 ] ; printf ( "Feed mapping with ID %d and criterion type %d was saved for feed with ID %d.\n" , $ feedMapping -> getFeedMappingId ( ) , $ feedMapping -> getCriterionType ( ) , $ feedMapping -> getFeedId ( ) ) ; }
Creates the feed mapping for the DSA page feeds.
Creates the feed mapping for the DSA page feeds .