ReportDefinitionService的Selector类遇到问题。该类不存在。以下是来自谷歌官方示例的代码:
// Load the service, so that the required classes are available.
$user->LoadService('ReportDefinitionService', 'v201603');
// Optional: Set clientCustomerId to get reports of your child accounts
// $user->SetClientCustomerId('INSERT_CLIENT_CUSTOMER_ID_HERE');
// Create selector.
$selector = new Selector(); //The error happens here. Class 'Selector' isn't found
$selector->fields = array('CampaignId', 'AdGroupId', 'Id', 'Criteria','CriteriaType', 'Impressions', 'Clicks', 'Cost');
文件/vvendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/v201603/ReportDefinitionService.php中没有Selector定义,而此类在许多其他服务中都有定义。
我正试图让它在Laravel 5.1 上工作
如果我将目录vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/v201603添加到我的classmap:,错误就会消失
"autoload": {
"classmap": [
...
"vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/v201603"
],
...
但我不确定我是否能做到。知道出了什么问题吗?
您所做的是正确的,正如本节所述。需要手动类映射,因为在src/Google/Api/Ads/AdWords/Util
下的每个版本目录中都有一些用相同名称声明的类。
在DownloadCriteriaReport示例中,ReportUtils.php文件包含在第29行。在ReportUtils中,类选择器是在包含ReportClasses文件时声明的。
希望得到帮助。
Thanet,AdWords API团队