PHP and Protobuf FieldMasks for Google API

252 Views Asked by At

I found the documentation just fine, but for the life of me I can't figure out how to set up the FieldMasks in PHP to update a CloudSchedulerClient.

The command should be like this: $client->updateJob($job, $updateMask); but no matter what I set the $updateMask variable to, my code keeps saying Expect Google\Protobuf\FieldMask. If for instance I wanted to update the description of a cron job to "test", 'description' => 'test', how should I go about that?

1

There are 1 best solutions below

1
On BEST ANSWER

If you share some code, that would be helpful.

The error suggests that you are not providing the proper type. Your code should look something like this:

use Google\Protobuf\FieldMask;

$updateMask = new FieldMask([
    'paths' => ['description']
]);

$client->updateJob($job, $updateMask);