0

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?

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449

1 Answers1

1

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);
jdp
  • 3,446
  • 2
  • 30
  • 54
  • Thanks so much, jdp, after some twaking I figured how to do the rest. In case anyone lands here and is making the same mistake, I was trying to load the job first, but this along with jdp's answer did it: ` $job = new Job(['name' => CloudSchedulerClient::jobName($projectId,$location,$name), 'description' => $description]);` – Tomasz Mieczkowski Dec 20 '19 at 18:35