我用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自动增量键,所以我完全迷失在哪里搜索信息o这个错误
PS:当我正确地运行php app/console generate:doctrine:entities TfgBundle
时,
答案 0 :(得分:0)
你可能为id字段设置了错误的类型,好的类型是“整数”而不是“id”:
/**
* @var integer $id
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id