本文整理汇总了PHP中StatementBuilder::ToStatement方法的典型用法代码示例。如果您正苦于以下问题:PHP StatementBuilder::ToStatement方法的具体用法?PHP StatementBuilder::ToStatement怎么用?PHP StatementBuilder::ToStatement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StatementBuilder
的用法示例。
在下文中一共展示了StatementBuilder::ToStatement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: syncDFPAPIplacement
public function syncDFPAPIplacement()
{
// Get the PlacementService.
$placementService = $this->dfp_user->GetService('PlacementService', 'v201508');
// Create a statement to select all placements.
$statementBuilder = new StatementBuilder();
$statementBuilder->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
// Get placements by statement.
$page = $placementService->getPlacementsByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
foreach ($page->results as $placement) {
$data[] = array($placement->id, $placement->name);
}
}
$field = array('dp_id', 'dp_name');
return $this->insert($this->table, $data, $field);
}
示例2: syncDFPAPIadvertiser
public function syncDFPAPIadvertiser()
{
$data = array();
// Get the CompanyService.
$companyService = $this->dfp_user->GetService('CompanyService', 'v201508');
// Create a statement to select only companies that are advertisers.
$statementBuilder = new StatementBuilder();
$statementBuilder->Where('type = :type')->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT)->WithBindVariableValue('type', 'ADVERTISER');
// Get companies by statement.
$page = $companyService->getCompaniesByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
foreach ($page->results as $company) {
$row = $this->getAdvertiserById($company->id);
if (!isset($row[0])) {
$data[] = array($company->id, $company->name);
}
}
}
$field = array('dfp_adv_id', 'dfp_adv_name');
return $this->insert($this->table, $data, $field, false);
}
示例3: DfpUser
// 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 ReconciliationLineItemReportService.
$reconciliationLineItemReportService = $user->GetService('ReconciliationLineItemReportService', 'v201602');
// Create a statement to select reconciliation line item reports for DFP line
// items.
$statementBuilder = new StatementBuilder();
$statementBuilder->Where('reconciliationReportId = :reconciliationReportId ' . 'AND lineItemId != :lineItemId')->OrderBy('lineItemId ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT)->WithBindVariableValue('reconciliationReportId', $reconciliationReportId)->WithBindVariableValue('lineItemId', 0);
// Default for total result set size.
$totalResultSetSize = 0;
do {
// Get reconciliation line item reports by statement.
$page = $reconciliationLineItemReportService->getReconciliationLineItemReportsByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
$totalResultSetSize = $page->totalResultSetSize;
$i = $page->startIndex;
foreach ($page->results as $reconciliationLineItemReport) {
printf("%d) Reconciliation line item report with ID %d for line item ID " . "%d was found, with reconciliation source '%s' and " . "reconciled volume '%d'.\n", $i++, $reconciliationLineItemReport->id, $reconciliationLineItemReport->lineItemId, $reconciliationLineItemReport->reconciliationSource, $reconciliationLineItemReport->reconciledVolume);
}
}
$statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
} while ($statementBuilder->GetOffset() < $totalResultSetSize);
printf("Number of results found: %d\n", $totalResultSetSize);
} catch (OAuth2Exception $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
ExampleUtils::CheckForOAuth2Errors($e);
开发者ID:googleads,项目名称:googleads-php-lib,代码行数:31,代码来源:GetReconciliationLineItemReportsForReconciliationReport.php
示例4: DfpUser
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 CreativeService.
$creativeService = $user->GetService('CreativeService', 'v201602');
// Create a statement to select all creatives.
$statementBuilder = new StatementBuilder();
$statementBuilder->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
$totalResultSetSize = 0;
do {
// Get creatives by statement.
$page = $creativeService->getCreativesByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
$totalResultSetSize = $page->totalResultSetSize;
$i = $page->startIndex;
foreach ($page->results as $creative) {
printf("%d) Creative with ID %d, and name '%s' was found.\n", $i++, $creative->id, $creative->name);
}
}
$statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
} while ($statementBuilder->GetOffset() < $totalResultSetSize);
printf("Number of results found: %d\n", $totalResultSetSize);
} catch (OAuth2Exception $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
ExampleUtils::CheckForOAuth2Errors($e);
示例5: DfpUser
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->GetService('OrderService', 'v201502');
// Create a statement to select all orders.
$statementBuilder = new StatementBuilder();
$statementBuilder->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
$totalResultSetSize = 0;
do {
// Get orders by statement.
$page = $orderService->getOrdersByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
$totalResultSetSize = $page->totalResultSetSize;
$i = $page->startIndex;
foreach ($page->results as $order) {
printf("%d) Order with ID %d, name '%s', and advertiser ID %d was " . "found.\n", $i++, $order->id, $order->name, $order->advertiserId);
}
}
$statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
} while ($statementBuilder->GetOffset() < $totalResultSetSize);
printf("Number of results found: %d\n", $totalResultSetSize);
} catch (OAuth2Exception $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
ExampleUtils::CheckForOAuth2Errors($e);
示例6: dirname
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
// Set the ID of the company to update.
$companyId = 'INSERT_COMPANY_ID_HERE';
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 CompanyService.
$companyService = $user->GetService('CompanyService', 'v201502');
// Create a statement to select a single company by ID.
$statementBuilder = new StatementBuilder();
$statementBuilder->Where('id = :id')->OrderBy('id ASC')->Limit(1)->WithBindVariableValue('id', $companyId);
// Get the company.
$page = $companyService->getCompaniesByStatement($statementBuilder->ToStatement());
$company = $page->results[0];
// Update the comment.
$company->comment = sprintf('%s - updated.', $company->comment);
// Update the company on the server.
$companies = $companyService->updateCompanies(array($company));
foreach ($companies as $updatedCompany) {
printf("Company with ID %d, name '%s', and comment '%s' was updated.\n", $updatedCompany->id, $updatedCompany->name, $updatedCompany->comment);
}
} catch (OAuth2Exception $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (Exception $e) {
printf("%s\n", $e->getMessage());
}
示例7: DfpUser
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 BaseRateService.
$baseRateService = $user->GetService('BaseRateService', 'v201602');
// Create a statement to select only base rates belonging to a rate card.
$statementBuilder = new StatementBuilder();
$statementBuilder->Where('rateCardId = :rateCardId')->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT)->WithBindVariableValue('rateCardId', $rateCardId);
// Default for total result set size.
$totalResultSetSize = 0;
do {
// Get base rates by statement.
$page = $baseRateService->getBaseRatesByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
$totalResultSetSize = $page->totalResultSetSize;
$i = $page->startIndex;
foreach ($page->results as $baseRate) {
printf("%d) Base rate with ID %d, and type '%s', belonging to rate " . "card ID %d was found.\n", $i++, $baseRate->id, get_class($baseRate), $baseRate->rateCardId);
}
}
$statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
} while ($statementBuilder->GetOffset() < $totalResultSetSize);
printf("Number of results found: %d\n", $totalResultSetSize);
} catch (OAuth2Exception $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
ExampleUtils::CheckForOAuth2Errors($e);
示例8: DfpUser
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 LineItemCreativeAssociationService.
$licaService = $user->GetService('LineItemCreativeAssociationService', 'v201508');
// Create a statement to select all LICAs for a line item.
$statementBuilder = new StatementBuilder();
$statementBuilder->Where('lineItemId = :lineItemId')->OrderBy('lineItemId ASC, creativeId ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT)->WithBindVariableValue('lineItemId', $lineItemId);
// Default for total result set size.
$totalResultSetSize = 0;
do {
// Get LICAs by statement.
$page = $licaService->getLineItemCreativeAssociationsByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
$totalResultSetSize = $page->totalResultSetSize;
$i = $page->startIndex;
foreach ($page->results as $lica) {
if (isset($lica->creativeSetId)) {
printf("%d) LICA with line item ID %d, and creative set ID %d will " . "be deactivated.\n", $i++, $lica->lineItemId, $lica->creativeSetId);
} else {
printf("%d) LICA with line item ID %d, and creative ID %d will be " . "deactivated.\n", $i++, $lica->lineItemId, $lica->creativeId);
}
}
}
$statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
} while ($statementBuilder->GetOffset() < $totalResultSetSize);
printf("Number of LICAs to be deactivated: %d\n", $totalResultSetSize);
示例9: DfpUser
// 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', 'v201602');
// Create a statement to select ad units under the parent ad unit and the
// parent ad unit.
$statementBuilder = new StatementBuilder();
$statementBuilder->Where('parentId = :parentId or id = :parentId')->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT)->WithBindVariableValue('parentId', $parentAdUnitId);
// Default for total result set size.
$totalResultSetSize = 0;
do {
// Get ad units by statement.
$page = $inventoryService->getAdUnitsByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
$totalResultSetSize = $page->totalResultSetSize;
$i = $page->startIndex;
foreach ($page->results as $adUnit) {
printf("%d) Ad unit with ID %d, and name '%s' will be archived.\n", $i++, $adUnit->id, $adUnit->name);
}
}
$statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
} while ($statementBuilder->GetOffset() < $totalResultSetSize);
printf("Number of ad units to be archived: %d\n", $totalResultSetSize);
if ($totalResultSetSize > 0) {
// Remove limit and offset from statement.
$statementBuilder->RemoveLimitAndOffset();
// Create action.
示例10: DfpUser
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', 'v201508');
// Create a statement to select only first party audience segments.
$statementBuilder = new StatementBuilder();
$statementBuilder->Where('type = :type')->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT)->WithBindVariableValue('type', 'FIRST_PARTY');
// Default for total result set size.
$totalResultSetSize = 0;
do {
// Get audience segments by statement.
$page = $audienceSegmentService->getAudienceSegmentsByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
$totalResultSetSize = $page->totalResultSetSize;
$i = $page->startIndex;
foreach ($page->results as $audienceSegment) {
printf("%d) Audience segment with ID %d, name '%s', and size %s was " . "found.\n", $i++, $audienceSegment->id, $audienceSegment->name, $audienceSegment->size);
}
}
$statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
} while ($statementBuilder->GetOffset() < $totalResultSetSize);
printf("Number of results found: %d\n", $totalResultSetSize);
} catch (OAuth2Exception $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
ExampleUtils::CheckForOAuth2Errors($e);
示例11: DfpUser
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 LineItemCreativeAssociationService.
$licaService = $user->GetService('LineItemCreativeAssociationService', 'v201602');
// Create a statement to select all LICAs.
$statementBuilder = new StatementBuilder();
$statementBuilder->OrderBy('lineItemId ASC, creativeId ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
$totalResultSetSize = 0;
do {
// Get LICAs by statement.
$page = $licaService->getLineItemCreativeAssociationsByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
$totalResultSetSize = $page->totalResultSetSize;
$i = $page->startIndex;
foreach ($page->results as $lica) {
if (isset($lica->creativeSetId)) {
printf("%d) LICA with line item ID %d, and creative set ID %d was " . "found.\n", $i++, $lica->lineItemId, $lica->creativeSetId);
} else {
printf("%d) LICA with line item ID %d, and creative ID %d was " . "found.\n", $i++, $lica->lineItemId, $lica->creativeId);
}
}
}
$statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
} while ($statementBuilder->GetOffset() < $totalResultSetSize);
printf("Number of results found: %d\n", $totalResultSetSize);
示例12: dirname
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
// Set the ID of the proposal line item to update.
$proposalLineItemId = 'INSERT_PROPOSAL_LINE_ITEM_ID_HERE';
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 ProposalLineItemService.
$proposalLineItemService = $user->GetService('ProposalLineItemService', 'v201508');
// Create a statement to select a single proposal line item by ID.
$statementBuilder = new StatementBuilder();
$statementBuilder->Where('id = :id')->OrderBy('id ASC')->Limit(1)->WithBindVariableValue('id', $proposalLineItemId);
// Get the proposal line item.
$page = $proposalLineItemService->getProposalLineItemsByStatement($statementBuilder->ToStatement());
$proposalLineItem = $page->results[0];
// Update the proposal line item's note field.
$proposalLineItem->notes = 'Proposal line item ready for submission.';
// Update the proposal line item on the server.
$proposalLineItems = $proposalLineItemService->updateProposalLineItems(array($proposalLineItem));
foreach ($proposalLineItems as $updatedProposalLineItem) {
printf("Proposal line item with ID %d and name '%s' was updated.\n", $updatedProposalLineItem->id, $updatedProposalLineItem->name);
}
} catch (OAuth2Exception $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (Exception $e) {
printf("%s\n", $e->getMessage());
}
示例13: DfpUser
$contentMetadataKeyHierarchyId = 'INSERT_CONTENT_METADATA_KEY_HIERARCHY_ID_HERE';
// Set the ID of the custom targeting key to be added as a hierarchy level.
$customTargetingKeyId = 'INSERT_CUSTOM_TARGETING_KEY_ID_HERE';
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 ContentMetadataKeyHierarchyService.
$contentMetadataKeyHierarchyService = $user->GetService('ContentMetadataKeyHierarchyService', 'v201608');
// Create a statement to select a single content metadata key hierarchy by ID.
$statementBuilder = new StatementBuilder();
$statementBuilder->Where('id = :id')->OrderBy('id ASC')->Limit(1)->WithBindVariableValue('id', $contentMetadataKeyHierarchyId);
// Get the content metadata key hierarchy.
$page = $contentMetadataKeyHierarchyService->getContentMetadataKeyHierarchiesByStatement($statementBuilder->ToStatement());
$contentMetadataKeyHierarchy = $page->results[0];
// Update the content metadata key hierarchy by adding a hierarchy level.
$hierarchyLevels = $contentMetadataKeyHierarchy->hierarchyLevels;
$hierarchyLevel = new ContentMetadataKeyHierarchyLevel();
$hierarchyLevel->customTargetingKeyId = $customTargetingKeyId;
$hierarchyLevel->hierarchyLevel = count($hierarchyLevels) + 1;
$contentMetadataKeyHierarchy->hierarchyLevels[] = $hierarchyLevel;
// Update the content metadata key hierarchy on the server.
$contentMetadataKeyHierarchies = $contentMetadataKeyHierarchyService->updateContentMetadataKeyHierarchies(array($contentMetadataKeyHierarchy));
foreach ($contentMetadataKeyHierarchies as $updatedContentMetadataKeyHierarchy) {
printf("Content metadata key hierarchy with ID %d, and name '%s' was " . "updated.\n", $updatedContentMetadataKeyHierarchy->id, $updatedContentMetadataKeyHierarchy->name);
}
} catch (OAuth2Exception $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
示例14: DfpUser
// 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 CreativeWrapperService.
$creativeWrapperService = $user->GetService('CreativeWrapperService', 'v201505');
// Create a statement to select the active creative wrappers for the given
// label.
$statementBuilder = new StatementBuilder();
$statementBuilder->Where('labelId = :labelId')->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT)->WithBindVariableValue('labelId', $labelId);
// Default for total result set size.
$totalResultSetSize = 0;
do {
// Get creative wrappers by statement.
$page = $creativeWrapperService->getCreativeWrappersByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
$totalResultSetSize = $page->totalResultSetSize;
$i = $page->startIndex;
foreach ($page->results as $creativeWrapper) {
printf("%d) Creative wrapper with ID %d, applying to label with ID %d, " . "with status %s will be deactivated.\n", $i++, $creativeWrapper->id, $creativeWrapper->labelId, $creativeWrapper->status);
}
}
$statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
} while ($statementBuilder->GetOffset() < $totalResultSetSize);
printf("Number of creative wrappers to be deactivated: %d\n", $totalResultSetSize);
if ($totalResultSetSize > 0) {
// Remove limit and offset from statement.
$statementBuilder->RemoveLimitAndOffset();
// Create action.
示例15: DfpUser
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 ProductService.
$productService = $user->GetService('ProductService', 'v201408');
// Create a statement to select all products.
$statementBuilder = new StatementBuilder();
$statementBuilder->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
$totalResultSetSize = 0;
do {
// Get products by statement.
$page = $productService->getProductsByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
$totalResultSetSize = $page->totalResultSetSize;
$i = $page->startIndex;
foreach ($page->results as $product) {
printf("%d) Product with ID %d, and name '%s' was found.\n", $i++, $product->id, $product->name);
}
}
$statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
} while ($statementBuilder->GetOffset() < $totalResultSetSize);
printf("Number of results found: %d\n", $totalResultSetSize);
} catch (OAuth2Exception $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
ExampleUtils::CheckForOAuth2Errors($e);