Merhabalar, aşağıdaki kodlar sayesinde firestore erişebiliyorum ancak ekleme veya okuma yapmak istediğimde hata alıyorum. Yanlış yaptığım kısmı gösterebilir misiniz? Kodlar ve hatalar aşağıdadır.
namespace Google\Cloud\Samples\Firestore;
use Google\Cloud\Firestore\FirestoreClient;
require 'vendor/autoload.php';
function initialize()
{
$db = new FirestoreClient([
"projectId" => "phptest-a1810"
]);
printf('Created Cloud Firestore client with default project ID.' . PHP_EOL);
}
initialize();Erişim tamam ancak aşağıdaki veri ekleme kısmında hata alıyorum
function add_data($projectId)
{
$db = new FirestoreClient([
'projectId' => $projectId,
]);
$docRef = $db->collection('users')->document('lovelace');
// users koleksiyonunda lovelace dökümanlarına eklemek istiyorum
$docRef->set([
'first' => 'Ada',
'last' => 'Lovelace',
'born' => 1815
]);
printf('Added data to the lovelace document in the users collection.' . PHP_EOL);
}
$proje='phptest-a1810';
add_data($proje);Fatal error: Uncaught RuntimeException: Credentials fetcher does not implement Google\Auth\UpdateMetadataInterface in C:\AppServ\www\firebase\vendor\google\auth\src\FetchAuthTokenCache.php:190 Stack trace: #0 C:\AppServ\www\firebase\vendor\google\gax\src\CredentialsWrapper.php(197): Google\Auth\FetchAuthTokenCache->updateMetadata(Array, 'https://firesto...') #1 [internal function]: Google\ApiCore\CredentialsWrapper->Google\ApiCore\{closure}(Object(stdClass)) #2 C:\AppServ\www\firebase\vendor\grpc\grpc\src\lib\UnaryCall.php(44): Grpc\Call->startBatch(Array) #3 C:\AppServ\www\firebase\vendor\grpc\grpc\src\lib\BaseStub.php(291): Grpc\UnaryCall->start(Object(Google\Cloud\Firestore\V1\CommitRequest), Array, Array) #4 C:\AppServ\www\firebase\vendor\grpc\grpc\src\lib\BaseStub.php(541): Grpc\BaseStub->Grpc\{closure}('/google.firesto...', Object(Google\Cloud\Firestore\V1\CommitRequest), Array, Array, Array) #5 C:\AppServ\www\firebase\vendor\google\gax\src\Transport\GrpcTransport.php(213): Grpc\BaseStub->_simpleRequest('/google.fir in C:\AppServ\www\firebase\vendor\google\auth\src\FetchAuthTokenCache.php on line 190