gpt4 book ai didi

php - 错误 Symfony Doctrine PostgreSQL : SQLSTATE[42703]: Undefined column: 7 ERROR

转载 作者:行者123 更新时间:2023-12-05 08:31:03 24 4
gpt4 key购买 nike

您好,我正在使用 Symfony,我正在尝试将我的项目连接到 PostgreSQL 服务器版本 9.6。我已经编辑了 .env 文件。然后我做了我的迁移。所以我在数据库中有新表,但是当我在我的网络应用程序中创建帐户时出现此错误。

An exception occurred while executing 'SELECT t0.id AS id_1, t0.username AS username_2, t0.password AS password_3, t0.email AS email_4, t0.confirmation_token AS confirmation_token_5, t0.account_activated AS account_activated_6 FROM user t0 WHERE t0.email = ?' with params ["machin@bidule.fr"]:

SQLSTATE[42703]: Undefined column: 7 ERROR: column t0.id does not exist
LINE 1: SELECT t0.id AS id_1, t0.username AS username_2, t0.password...

我已经用过了

php bin/console doctrine:schema:update --force

但这并没有改变什么。我还在 php.ini 文件中添加了正确的扩展。

最佳答案

将来,不要更改表名,而是添加 @ORM\Table(name="user")。如下所示。注意重音符号 (`) diacritical mark .

namespace App\Entity;use Doctrine\ORM\Mapping as ORM;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use Symfony\Component\Security\Core\User\UserInterface;/** * @ORM\Entity(repositoryClass="App\Repository\UserRepository") * @ORM\Table(name="`user`") * @UniqueEntity(fields={"username"}, message="There is already an account with this username") */class User implements UserInterface{    /**     * @ORM\Id()     * @ORM\GeneratedValue()     * @ORM\Column(type="integer")     */.....the rest of code continues...

关于php - 错误 Symfony Doctrine PostgreSQL : SQLSTATE[42703]: Undefined column: 7 ERROR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60206547/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com