PHP 和 Google API 的 Protobuf FieldMasks
PHP and Protobuf FieldMasks for Google API
我发现 the documentation 很好,但对于我来说,我无法弄清楚如何在 PHP 中设置 FieldMasks 来更新 CloudSchedulerClient。
命令应该是这样的:
$client->updateJob($job, $updateMask);
但无论我将 $updateMask
变量设置为什么,我的代码一直显示 Expect Google\Protobuf\FieldMask
。例如,如果我想将 cron 作业的描述更新为 "test"、'description' => 'test'
,我应该怎么做?
如果您分享一些代码,那将会很有帮助。
该错误表明您没有提供正确的类型。您的代码应如下所示:
use Google\Protobuf\FieldMask;
$updateMask = new FieldMask([
'paths' => ['description']
]);
$client->updateJob($job, $updateMask);
我发现 the documentation 很好,但对于我来说,我无法弄清楚如何在 PHP 中设置 FieldMasks 来更新 CloudSchedulerClient。
命令应该是这样的:
$client->updateJob($job, $updateMask);
但无论我将 $updateMask
变量设置为什么,我的代码一直显示 Expect Google\Protobuf\FieldMask
。例如,如果我想将 cron 作业的描述更新为 "test"、'description' => 'test'
,我应该怎么做?
如果您分享一些代码,那将会很有帮助。
该错误表明您没有提供正确的类型。您的代码应如下所示:
use Google\Protobuf\FieldMask;
$updateMask = new FieldMask([
'paths' => ['description']
]);
$client->updateJob($job, $updateMask);