php/codeigniter firestore 更新给出错误 InvalidArgumentException Input missing required one or more required keys
php/codeigniter firestore update giving error InvalidArgumentException Input missing required one or more required keys
我正在尝试将 php-codeigniter 上的管理面板与 firestore/firebase 连接。 Insertion、Fetch 和 Set 函数工作正常,但是当我尝试更新(更新单个键)时,它给出了 InvalidArgumentException。我正在关注官方文档 here 。我是 Firestore 的新手。欢迎提出建议。
这是我的代码
<?php
require 'vendor/autoload.php';
use Kreait\Firebase\Factory;
class Panelmodel extends CI_Model
{
public function __construct()
{
parent::__construct();
$factory = (new Factory)->withServiceAccount(FCPATH . "/settings/firebase.json")
->createFirestore();
$this->db = $factory->database();
}
function update($id)
{
$document = $this->db->collection('Users')
->document($id);
$document->update([['status' => false]]);
}
}
错误输出
<h4>An uncaught Exception was encountered</h4>
<p>Type: InvalidArgumentException</p>
<p>Message: Input missing required one or more required keys. Required keys are path, value</p>
<p>Filename: /var/www/doer/vendor/google/cloud-core/src/ValidateTrait.php</p>
我正在尝试将 php-codeigniter 上的管理面板与 firestore/firebase 连接。 Insertion、Fetch 和 Set 函数工作正常,但是当我尝试更新(更新单个键)时,它给出了 InvalidArgumentException。我正在关注官方文档 here 。我是 Firestore 的新手。欢迎提出建议。
这是我的代码
<?php
require 'vendor/autoload.php';
use Kreait\Firebase\Factory;
class Panelmodel extends CI_Model
{
public function __construct()
{
parent::__construct();
$factory = (new Factory)->withServiceAccount(FCPATH . "/settings/firebase.json")
->createFirestore();
$this->db = $factory->database();
}
function update($id)
{
$document = $this->db->collection('Users')
->document($id);
$document->update([['status' => false]]);
}
}
错误输出
<h4>An uncaught Exception was encountered</h4>
<p>Type: InvalidArgumentException</p>
<p>Message: Input missing required one or more required keys. Required keys are path, value</p>
<p>Filename: /var/www/doer/vendor/google/cloud-core/src/ValidateTrait.php</p>