How to fix error: "Call to a member function listSpatialIndexes() on null" and why is it happening?

How to fix error: "Call to a member function listSpatialIndexes() on null" and why is it happening?

我有命令:

php bin/console doctrine:schema:validate -e prod

当我 运行 它时,出现错误

"Call to a member function listSpatialIndexes() on null".

请帮助我解释为什么会发生以及如何解决它。

此外,命令 "php bin/console doctrine:schema:validate -e dev" 以错误

结束

"[ERROR] The database schema is not in sync with the current mapping file."

问题是 doctrine.yaml 中的 pgsql 中的变量 server_version 不存在。要解决此问题,请添加

 pgsql:
    ...
    server_version: <insert your server version here, in my case 11.3>

您可以通过在供应商文件vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php.[=11 的第452 行添加echo($this->getServerVersion()) 然后exit(1) 来查看服务器的版本=]