Doctrine自动创建所有数据库表? [英] Doctrine automatically create all the database tables?

查看:87
本文介绍了Doctrine自动创建所有数据库表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  doctrine:schema:update  - 强制


解决方案

使用SchemaTool和EntityManager,您可以这样做: / p>

  $ schemaTool = new \Doctrine\ORM\Tools\SchemaTool($ entityManager); 
$ classes = $ entityManager-> getMetadataFactory() - > getAllMetadata();
$ schemaTool-> createSchema($ classes);


is there any way to tell doctrine automaticaly create schema tables without using this command :

doctrine:schema:update --force

解决方案

Using SchemaTool and EntityManager you can do this:

$schemaTool = new \Doctrine\ORM\Tools\SchemaTool($entityManager);
$classes = $entityManager->getMetadataFactory()->getAllMetadata();
$schemaTool->createSchema($classes);

这篇关于Doctrine自动创建所有数据库表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆