dongwu5801 2015-10-28 02:27
浏览 50
已采纳

Google Calendar API会获取可用的事件颜色,从而导致未定义的方法致命错误

I'm trying to fetch the available event colors for a calendar, and I'm getting this error:

PHP Fatal error: Call to undefined method Google_Service_Calendar_Colors_Resource::getEvent()

From the last line of this code:

  $client = new Google_Client();
  $client->setClientId($configArray['google']['calsync']['client_id']);
  $client->setClientSecret($configArray['google']['calsync']['client_secret']);
  $client->setRedirectUri($configArray['google']['calsync']['redirect_uri']);
  $client->setUseBatch(true);
  $client->setScopes('calendar');
  $client->setAccessToken("ACCESSTOKEN");
  $cal_client = new Google_Service_Calendar($client);

  $colors = $cal_client->colors->get();
  $event_colors = $colors->getEvent();

Why is this happening? What can I do to catch this error? I'm following the example used on: https://developers.google.com/google-apps/calendar/v3/reference/colors/get

  • 写回答

1条回答 默认 最新

  • duancai1904 2015-10-28 02:40
    关注

    I figured out the problem. The following code, which sets the client to batch requests is causing the fatal error. This code:

    $client->setUseBatch(true);
    

    Should not be present, or it should be:

    $client->setUseBatch(false);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划