We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
foreach() argument must be of type array|object, null given at vendor\google\gax\src\RequestBuilder.php:174 170▕ 171▕ $body = null; 172▕ $queryParams = []; 173▕ $messageData = json_decode($messageDataJson, true); ➜ 174▕ foreach ($messageData as $name => $value) { 175▕ if (array_key_exists($name, $config['placeholders'])) { 176▕ continue; 177▕ } 178▕ 1 vendor\google\gax\src\RequestBuilder.php:174 Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}("foreach() argument must be of type array|object, null given", "C:\...\vendor\google\gax\src\RequestBuilder.php") 2 vendor\google\gax\src\RequestBuilder.php:110 Google\ApiCore\RequestBuilder::constructBodyAndQueryParameters(Object(Google\Cloud\AIPlatform\V1\CreateDatasetRequest), ["post", "/v1/{parent=projects/*/locations/*}/datasets", "dataset"])
The code it's the same of the example https://github.com/googleapis/google-cloud-php-ai-platform/blob/main/samples/V1/DatasetServiceClient/create_dataset.php.
// The called to function are: $formattedParent = DatasetServiceClient::locationName('lab-ia-430919', 'us-central1'); $this->create_dataset( $formattedParent, 'example-ventas', 'gs://bucket-ia-example/schemaDatasetVertexAI.yaml' ); function create_dataset( string $formattedParent, string $datasetDisplayName, string $datasetMetadataSchemaUri ): void { // Create a client. $datasetServiceClient = new DatasetServiceClient(); // Prepare the request message. $datasetMetadata = new Value(); $dataset = (new Dataset()) ->setName($datasetDisplayName) ->setDisplayName($datasetDisplayName) ->setMetadataSchemaUri($datasetMetadataSchemaUri) ->setMetadata($datasetMetadata); $request = (new CreateDatasetRequest()) ->setParent($formattedParent) ->setDataset($dataset); // Call the API and handle any network failures. try { /** @var OperationResponse $response */ $response = $datasetServiceClient->createDataset($request); $response->pollUntilComplete(); if ($response->operationSucceeded()) { /** @var Dataset $result */ $result = $response->getResult(); printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); } else { /** @var Status $error */ $error = $response->getError(); printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); } } catch (ApiException $ex) { printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Environment details
Steps to reproduce
The code it's the same of the example https://github.com/googleapis/google-cloud-php-ai-platform/blob/main/samples/V1/DatasetServiceClient/create_dataset.php.
Code example
The text was updated successfully, but these errors were encountered: