当前位置: 首页>>代码示例>>PHP>>正文


PHP MapUtils::GetMapEntries方法代码示例

本文整理汇总了PHP中MapUtils::GetMapEntries方法的典型用法代码示例。如果您正苦于以下问题:PHP MapUtils::GetMapEntries方法的具体用法?PHP MapUtils::GetMapEntries怎么用?PHP MapUtils::GetMapEntries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MapUtils的用法示例。


在下文中一共展示了MapUtils::GetMapEntries方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetMapEntries_NamedEntries

 /**
  * Test getting map entries from a map, using a named map entries class.
  * @covers MapUtils::GetMapEntries
  */
 public function testGetMapEntries_NamedEntries()
 {
     $map = array('foo' => 'bar');
     $result = MapUtils::GetMapEntries($map, 'TestMapEntry');
     $this->assertEquals(1, sizeof($result));
     $this->assertTrue($result[0] instanceof TestMapEntry);
     $this->assertEquals('foo', $result[0]->key);
     $this->assertEquals('bar', $result[0]->value);
 }
开发者ID:sambavade,项目名称:google-api-adwords-php,代码行数:13,代码来源:MapUtilsTest.php

示例2: getOrdersByCompanyId

 public function getOrdersByCompanyId($id = false)
 {
     if (!$id) {
         return;
     }
     $path = dirname(__FILE__) . '/dfp/src';
     set_include_path(get_include_path() . PATH_SEPARATOR . $path);
     require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
     require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
     $token = "company_orders_" . $id;
     if (($data = Cache::read($token, "5min")) === false) {
         $data = array();
         try {
             // Get DfpUser from credentials in "../auth.ini"
             // relative to the DfpUser.php file's directory.
             $user = new DfpUser();
             // Log SOAP XML request and response.
             $user->LogDefaults();
             // Get the OrderService.
             $orderService = $user->GetOrderService('v201108');
             // Set the ID of the advertiser (company) to get orders for.
             $advertiserId = (double) $id;
             // Create bind variables.
             $vars = MapUtils::GetMapEntries(array('advertiserId' => new NumberValue($advertiserId)));
             // Create a statement to only select orders for a given advertiser.
             $filterStatement = new Statement("WHERE advertiserId = :advertiserId LIMIT 500", $vars);
             // Get orders by statement.
             $page = $orderService->getOrdersByStatement($filterStatement);
             // Display results.
             if (isset($page->results)) {
                 $i = $page->startIndex;
                 foreach ($page->results as $k => $order) {
                     $data[$k]['id'] = $order->id;
                     $data[$k]['name'] = $order->name;
                     $data[$k]['advertiserId'] = $order->advertiserId;
                 }
             }
             Cache::write($token, $data, "5min");
         } catch (Exception $e) {
             die($e->getMessage());
         }
     }
     return $data;
 }
开发者ID:josephbergdoll,项目名称:berrics,代码行数:44,代码来源:DfpApi.php

示例3: dirname

// DfpUser.php directly via require_once.
// $path = '/path/to/dfp_api_php_lib/src';
$path = dirname(__FILE__) . '/../../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the LabelService.
    $labelService = $user->GetService('LabelService', 'v201108');
    // Create bind variables.
    $vars = MapUtils::GetMapEntries(array('type' => new TextValue('COMPETITIVE_EXCLUSION')));
    // Create a statement to only select labels that are advertisers sorted
    // by name.
    $filterStatement = new Statement("WHERE type = :type ORDER BY name LIMIT 500", $vars);
    // Get labels by statement.
    $page = $labelService->getLabelsByStatement($filterStatement);
    // Display results.
    if (isset($page->results)) {
        $i = $page->startIndex;
        foreach ($page->results as $label) {
            printf("%d) Label with ID '%s', name '%s', and type '%s' was found.\n", $i, $label->id, $label->name, $label->type);
            $i++;
        }
    }
    print 'Number of results found: ' . $page->totalResultSetSize . "\n";
} catch (Exception $e) {
开发者ID:RayViljoen,项目名称:Auto-DFP,代码行数:31,代码来源:GetLabelsByStatementExample.php

示例4: dirname

$path = dirname(__FILE__) . '/../../../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the SuggestedAdUnitService.
    $suggestedAdUnitService = $user->GetService('SuggestedAdUnitService', 'v201208');
    // Create a statement to only select suggested ad units with more than 50
    // requests.
    $filterStatement = new Statement("WHERE numRequests > :numRequests LIMIT 500", MapUtils::GetMapEntries(array('numRequests' => new NumberValue(50))));
    // Get ad units by statement.
    $page = $suggestedAdUnitService->getSuggestedAdUnitsByStatement($filterStatement);
    // Display results.
    if (isset($page->results)) {
        $i = $page->startIndex;
        foreach ($page->results as $suggestedAdUnit) {
            printf("%d) Suggested ad unit with ID '%s' and number of requests '%d' " . "was found.\n", $i, $suggestedAdUnit->id, $suggestedAdUnit->numRequests);
            $i++;
        }
    }
    print 'Number of results found: ' . $page->totalResultSetSize . "\n";
} catch (OAuth2Exception $e) {
    ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
    ExampleUtils::CheckForOAuth2Errors($e);
开发者ID:venkyanthony,项目名称:google-api-dfp-php,代码行数:31,代码来源:GetSuggestedAdUnitsByStatementExample.php

示例5: dirname

require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the UserTeamAssociationService.
    $userTeamAssociationService = $user->GetService('UserTeamAssociationService', 'v201311');
    // Get the UserService.
    $userService = $user->GetService("UserService", "v201311");
    // Get the current user.
    $currentUserId = $userService->getCurrentUser()->id;
    // Create bind variables.
    $vars = MapUtils::GetMapEntries(array('userId' => new NumberValue($currentUserId)));
    // Create filter text to select user team associations by the user ID.
    $filterStatement = new Statement("WHERE userId = :userId LIMIT 500", $vars);
    // Get user team associations by statement.
    $page = $userTeamAssociationService->getUserTeamAssociationsByStatement($filterStatement);
    // Display results.
    if (isset($page->results)) {
        $i = $page->startIndex;
        foreach ($page->results as $uta) {
            print $i . ') User team association between user with ID "' . $uta->userId . '" and team with ID "' . $uta->teamId . "\" was found.\n";
            $i++;
        }
    }
    print 'Number of results found: ' . $page->totalResultSetSize . "\n";
} catch (OAuth2Exception $e) {
    ExampleUtils::CheckForOAuth2Errors($e);
开发者ID:planetfitnessnational,项目名称:googleads-php-lib,代码行数:31,代码来源:GetUserTeamAssociationsByStatementExample.php

示例6: dirname

$path = dirname(__FILE__) . '/../../../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the CreativeSetService.
    $creativeSetService = $user->GetService('CreativeSetService', 'v201311');
    $masterCreativeID = 'INSERT_MASTER_CREATIVE_ID_HERE';
    // Create bind variables.
    $vars = MapUtils::GetMapEntries(array('masterCreativeId' => new NumberValue($masterCreativeID)));
    // Create a statement object to only select creative sets that have the given
    // master creative.
    $filterStatement = new Statement("WHERE masterCreativeId = :masterCreativeId LIMIT 500", $vars);
    // Get creative sets by statement.
    $page = $creativeSetService->getCreativeSetsByStatement($filterStatement);
    // Display results.
    if (isset($page->results)) {
        $i = $page->startIndex;
        foreach ($page->results as $creativeSet) {
            printf("A creative set with ID '%s', name '%s', master creative ID '%s' " . ", and companion creativeID(s) {%s} was found.\n", $creativeSet->id, $creativeSet->name, $creativeSet->masterCreativeId, join(',', $creativeSet->companionCreativeIds));
            $i++;
        }
    }
    print 'Number of results found: ' . $page->totalResultSetSize . "\n";
} catch (OAuth2Exception $e) {
开发者ID:planetfitnessnational,项目名称:googleads-php-lib,代码行数:31,代码来源:GetCreativeSetsByStatementExample.php

示例7: DfpUser

 // relative to the DfpUser.php file's directory.
 $user = new DfpUser();
 // Log SOAP XML request and response.
 $user->LogDefaults();
 // Get the ContentService.
 $contentService = $user->GetService('ContentService', 'v201408');
 // Get the NetworkService.
 $networkService = $user->GetService('NetworkService', 'v201408');
 // Get the CustomTargetingService.
 $customTargetingService = $user->GetService('CustomTargetingService', 'v201408');
 // Get content browse custom targeting key ID.
 $network = $networkService->getCurrentNetwork();
 $contentBrowseCustomTargetingKeyId = $network->contentBrowseCustomTargetingKeyId;
 // Create a statement to select the categories matching the name comedy.
 $categoryFilterStatement = new Statement("WHERE customTargetingKeyId = :contentBrowseCustomTargetingKeyId " . "and name = :category LIMIT 1");
 $categoryFilterStatement->values = MapUtils::GetMapEntries(array('contentBrowseCustomTargetingKeyId' => new NumberValue($contentBrowseCustomTargetingKeyId), 'category' => new TextValue('comedy')));
 // Get categories matching the filter statement.
 $customTargetingValuePage = $customTargetingService->getCustomTargetingValuesByStatement($categoryFilterStatement);
 // Get the custom targeting value ID for the comedy category.
 $categoryCustomTargetingValueId = $customTargetingValuePage->results[0]->id;
 // Create a statement to get all active content.
 $filterStatement = new Statement("WHERE status = 'ACTIVE' LIMIT 500");
 // Get content by statement.
 $page = $contentService->getContentByStatementAndCustomTargetingValue($filterStatement, $categoryCustomTargetingValueId);
 // Display results.
 if (isset($page->results)) {
     $i = $page->startIndex;
     foreach ($page->results as $content) {
         printf("%d) Content with ID '%s', name '%s', and status '%s' was found.\n", $i, $content->id, $content->name, $content->status);
         $i++;
     }
开发者ID:planetfitnessnational,项目名称:googleads-php-lib,代码行数:31,代码来源:GetContentByCategory.php

示例8: DfpUser

require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the CustomTargetingService.
    $customTargetingService = $user->GetCustomTargetingService('v201104');
    // Set ID of the custom targeting key to delete values from.
    $keyId = (double) 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE';
    // Create statement text to only select custom values by the given custom
    // targeting key ID.
    $filterStatementText = 'WHERE customTargetingKeyId = :keyId';
    // Create bind variables.
    $vars = MapUtils::GetMapEntries(array('keyId' => new NumberValue($keyId)));
    $offset = 0;
    $valueIds = array();
    do {
        // Create statement to page through results.
        $filterStatement = new Statement($filterStatementText . ' LIMIT 500 OFFSET ' . $offset, $vars);
        // Get custom targeting values by statement.
        $page = $customTargetingService->getCustomTargetingValuesByStatement($filterStatement);
        if (isset($page->results)) {
            foreach ($page->results as $customTargetingValue) {
                $valueIds[] = $customTargetingValue->id;
            }
        }
        $offset += 500;
    } while ($offset < $page->totalResultSetSize);
    printf("Number of custom targeting values to be deleted: %d\n", sizeof($valueIds));
开发者ID:RayViljoen,项目名称:Auto-DFP,代码行数:31,代码来源:DeleteCustomTargetingValuesExample.php

示例9: set_include_path

set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the CustomTargetingService.
    $customTargetingService = $user->GetService('CustomTargetingService', 'v201306');
    // Set the ID of the custom targeting key to get custom targeting values for.
    $valueId = 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE';
    // Create a statement to only select custom targeting values for a given key.
    $filterStatement = new Statement('WHERE customTargetingKeyId = :keyId LIMIT 500', MapUtils::GetMapEntries(array('keyId' => new NumberValue($valueId))));
    // Get custom targeting keys by statement.
    $page = $customTargetingService->getCustomTargetingValuesByStatement($filterStatement);
    if (isset($page->results)) {
        $values = $page->results;
        // Update each local custom targeting value object by changing its display
        // name.
        foreach ($values as $value) {
            if (empty($value->displayName)) {
                $value->displayName = $value->name;
            }
            $value->displayName .= ' (Deprecated)';
        }
        // Update the custom targeting values on the server.
        $values = $customTargetingService->updateCustomTargetingValues($values);
        // Display results.
开发者ID:venkyanthony,项目名称:google-api-dfp-php,代码行数:31,代码来源:UpdateCustomTargetingValuesExample.php

示例10: DfpUser

require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the CustomTargetingService.
    $customTargetingService = $user->GetService('CustomTargetingService', 'v201208');
    // Set the name of the custom targeting key to delete.
    $keyName = 'INSERT_CUSTOM_TARGETING_KEY_NAME_HERE';
    // Create statement text to only select custom targeting key by the given
    // name.
    $filterStatementText = 'WHERE name = :name';
    // Create bind variables.
    $vars = MapUtils::GetMapEntries(array('name' => new TextValue($keyName)));
    $offset = 0;
    $keyIds = array();
    do {
        // Create statement to page through results.
        $filterStatement = new Statement($filterStatementText . ' LIMIT 500 OFFSET ' . $offset, $vars);
        // Get custom targeting keys by statement.
        $page = $customTargetingService->getCustomTargetingKeysByStatement($filterStatement);
        if (isset($page->results)) {
            foreach ($page->results as $customTargetingKey) {
                $keyIds[] = $customTargetingKey->id;
            }
        }
        $offset += 500;
    } while ($offset < $page->totalResultSetSize);
    printf("Number of custom targeting keys to be deleted: %d\n", sizeof($keyIds));
开发者ID:venkyanthony,项目名称:google-api-dfp-php,代码行数:31,代码来源:DeleteCustomTargetingKeysExample.php

示例11: dirname

$path = dirname(__FILE__) . '/../../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the LineItemService.
    $lineItemService = $user->GetLineItemService('v201104');
    // Set the ID of the order to get line items from.
    $orderId = (double) 'INSERT_ORDER_ID_HERE';
    // Create bind variables.
    $vars = MapUtils::GetMapEntries(array('orderId' => new NumberValue($orderId)));
    // Create statement text to select approved line items from a given order.
    $filterStatementText = "WHERE orderId = :orderId AND status = 'NEEDS_CREATIVES'";
    $offset = 0;
    do {
        // Create statement to page through results.
        $filterStatement = new Statement($filterStatementText . " LIMIT 500 OFFSET " . $offset, $vars);
        // Get line items by statement.
        $page = $lineItemService->getLineItemsByStatement($filterStatement);
        // Display results.
        $lineItemIds = array();
        if (isset($page->results)) {
            $i = $page->startIndex;
            foreach ($page->results as $lineItem) {
                // Archived line items cannot be activated.
                if (!$lineItem->isArchived) {
开发者ID:RayViljoen,项目名称:Auto-DFP,代码行数:31,代码来源:ActivateLineItemsExample.php

示例12: dirname

$path = dirname(__FILE__) . '/../../../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the AudienceSegmentService.
    $audienceSegmentService = $user->GetService('AudienceSegmentService', 'v201405');
    $audienceSegmentId = 'INSERT_AUDIENCE_SEGMENT_ID_HERE';
    // Create bind variables.
    $vars = MapUtils::GetMapEntries(array('type' => new TextValue('FIRST_PARTY'), 'audienceSegmentId' => new NumberValue($audienceSegmentId)));
    // Statement parts to help build a statement to select specified first party
    // audience segment.
    $pqlTemplate = "WHERE id IN (:audienceSegmentId) AND type = :type ORDER BY " . "id LIMIT %d OFFSET %d";
    $SUGGESTED_PAGE_LIMIT = 500;
    $offset = 0;
    $page = new AudienceSegmentPage();
    do {
        // Get audience segments by statement.
        $page = $audienceSegmentService->getAudienceSegmentsByStatement(new Statement(sprintf($pqlTemplate, $SUGGESTED_PAGE_LIMIT, $offset), $vars));
        // Display results.
        $audienceSegmentIds = array();
        if (isset($page->results)) {
            $i = $page->startIndex;
            foreach ($page->results as $audienceSegment) {
                printf("%d) Audience segment with ID \"%d\" and name \"%s\" will be " . "populated.\n", $i++, $audienceSegment->id, $audienceSegment->name);
开发者ID:planetfitnessnational,项目名称:googleads-php-lib,代码行数:31,代码来源:PopulateFirstPartyAudienceSegments.php

示例13: DfpUser

require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the InventoryService.
    $inventoryService = $user->GetService('InventoryService', 'v201403');
    // Get the NetworkService.
    $networkService = $user->GetService('NetworkService', 'v201403');
    // Get the effective root ad unit's ID.
    $network = $networkService->getCurrentNetwork();
    $effectiveRootAdUnitId = $network->effectiveRootAdUnitId;
    // Create a statement to select the children of the effective root ad unit.
    $filterStatement = new Statement("WHERE parentId = :id LIMIT 500", MapUtils::GetMapEntries(array('id' => new NumberValue($effectiveRootAdUnitId))));
    // Get ad units by statement.
    $page = $inventoryService->getAdUnitsByStatement($filterStatement);
    // Display results.
    if (isset($page->results)) {
        $i = $page->startIndex;
        foreach ($page->results as $adUnit) {
            print $i . ') Ad unit with ID "' . $adUnit->id . '", name "' . $adUnit->name . '", and status "' . $adUnit->status . "\" was found.\n";
            $i++;
        }
    }
    print 'Number of results found: ' . $page->totalResultSetSize . "\n";
} catch (OAuth2Exception $e) {
    ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
    ExampleUtils::CheckForOAuth2Errors($e);
开发者ID:planetfitnessnational,项目名称:googleads-php-lib,代码行数:31,代码来源:GetAdUnitsByStatementExample.php

示例14: dirname

// DfpUser.php directly via require_once.
// $path = '/path/to/dfp_api_php_lib/src';
$path = dirname(__FILE__) . '/../../../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the InventoryService.
    $inventoryService = $user->GetService('InventoryService', 'v201403');
    // Create bind variables.
    $vars = MapUtils::GetMapEntries(array('targetPlatform' => new TextValue('WEB')));
    // Create a statement to only select web ad units sizes.
    $filterStatement = new Statement("WHERE targetPlatform = :targetPlatform", $vars);
    // Get all ad unit sizes by statement.
    $adUnitSizes = $inventoryService->getAdUnitSizesByStatement($filterStatement);
    // Display results.
    $i = 0;
    foreach ($adUnitSizes as $adUnitSize) {
        printf("%d) Web ad unit size of dimensions %s was found.\n", $i, $adUnitSize->fullDisplayString);
        $i++;
    }
    printf("Number of ad unit sizes found: %d\n", count($adUnitSizes));
} catch (OAuth2Exception $e) {
    ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
    ExampleUtils::CheckForOAuth2Errors($e);
开发者ID:planetfitnessnational,项目名称:googleads-php-lib,代码行数:31,代码来源:GetAdUnitSizesExample.php

示例15: DfpUser

require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
require_once 'Google/Api/Ads/Dfp/Util/DateTimeUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the LineItemService.
    $lineItemService = $user->GetService('LineItemService', 'v201311');
    // Set the ID of the order to get line items from.
    $orderId = 'INSERT_ORDER_ID_HERE';
    // Calculate time from three days ago.
    $threeDaysAgo = date(DateTimeUtils::$DFP_DATE_TIME_STRING_FORMAT, strtotime('-3 day'));
    // Create bind variables.
    $vars = MapUtils::GetMapEntries(array('orderId' => new NumberValue($orderId), 'threeDaysAgo' => new TextValue($threeDaysAgo)));
    // Create statement object to only select line items belonging to the order
    // and have been modified in the last 3 days.
    $filterStatement = new Statement("WHERE orderId = :orderId " . "AND lastModifiedDateTime >= :threeDaysAgo " . "LIMIT 500", $vars);
    // Get line items by statement.
    $page = $lineItemService->getLineItemsByStatement($filterStatement);
    // Display results.
    if (isset($page->results)) {
        $i = $page->startIndex;
        foreach ($page->results as $lineItem) {
            // Format lastModifiedDateTime for printing.
            $lastModifiedDateTime = DateTimeUtils::GetDateTime($lineItem->lastModifiedDateTime);
            $lastModifiedDateTimeText = $lastModifiedDateTime->format(DateTimeUtils::$DFP_DATE_TIME_STRING_FORMAT);
            print $i . ') Line item with ID "' . $lineItem->id . '", belonging to order ID "' . $lineItem->orderId . '", with name "' . $lineItem->name . '", and last modified ' . $lastModifiedDateTimeText . " was found.\n";
            $i++;
        }
开发者ID:planetfitnessnational,项目名称:googleads-php-lib,代码行数:31,代码来源:GetRecentlyUpdatedLineItems.php


注:本文中的MapUtils::GetMapEntries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。