更新时间:2023-09-18 23:32:40
这是你可以做到的方法,
Here is the way you can do it,
第一步,让 Doctrine 内省数据库并生成相应的 xml 或 yml 元数据文件.
First step, ask Doctrine to introspect the database and generate the corresponding xml or yml metadata files.
php app/console doctrine:mapping:convert [xml|yml] Path/To/MyBundle/Resources/config/doctrine/metadata/orm --from-database --force --filter=MyTable
第二步,通过执行以下两个命令,让 Doctrine 导入架构并构建相关实体类.
Second step, ask Doctrine to import the schema and build related entity classes by executing the following two commands.
php app/console doctrine:mapping:import MyBundle [xml|yml|annotation] --filter=MyTable
php app/console doctrine:generate:entities Path\To\MyBundle\EntityFolder\\MyTable
查看文档的如何从现有数据库生成实体部分