0

我用 symfony 制作我的第一个项目,在我创建实体以制作数据库之后,当我运行时出现php app/console doctrine:schema:create --dump-sql此错误

[Doctrine\DBAL\DBALException]
Unknown column type "id" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypeMap(). If this error occurs during database introspection then you might have forgot to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMapped DatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information.

我所有的实体/表都有一个 id 自动增量键,所以我完全不知道在哪里搜索这个错误的信息

PS:当我运行php app/console generate:doctrine:entities TfgBundle一切正常时。

4

1 回答 1

0

您可能为 id 字段设置了错误的类型,好的类型是“integer”而不是“id”:

    /**
     * @var integer $id
     *
     * @ORM\Id
     * @ORM\Column(name="id", type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id
于 2013-08-20T10:16:09.980 回答