错误 Symfony Doctrine PostgreSQL:SQLSTATE[42703]:未定义列:7 错误

Dud*_*y83 2 php postgresql doctrine symfony

您好,我正在使用 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...
Run Code Online (Sandbox Code Playgroud)

我已经用过

php bin/console doctrine:schema:update --force
Run Code Online (Sandbox Code Playgroud)

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

Nga*_*ine 7

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

命名空间应用\实体;

使用 Doctrine\ORM\Mapping 作为 ORM;
使用 Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
使用 Symfony\Component\Security\Core\User\UserInterface;

/**
 * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
 * @ORM\Table(名称=“`用户`”)
 * @UniqueEntity(fields={"username"}, message="已经有一个使用该用户名的帐户")
 */
User 类实现 UserInterface
{
    /**
     * @ORM\Id()
     * @ORM\GenerateValue()
     * @ORM\Column(类型=“整数”)
     */

......其余代码继续......