从数据库模式生成带注释的doctrine2实体
是否可以从现有数据库模式生成带有相关文档块注释的 Doctrine 2 实体?
Is it possible to generate Doctrine 2 entities, with the relevant docblock annotations, from an existing database schema?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我必须对上面的代码进行这些更改才能工作..
和 mysql 连接配置如下:
I had to made these changes for the above code to work..
and mysql connection configuration like :
是的,虽然不完全支持 RDBMS 数据类型,但有可能,因此在项目中使用代码之前,您可能需要先尝试一下代码。它并不像 Doctrine 1.x 过去那样直接,但仍然相当简单。这是我自己使用的一些示例代码(在使用之前正确创建文件夹)
Yes it possible though RDBMS data types are not fully supported, so you might have to play with your code a bit before using it in your project. It's not straight forward as Doctrine 1.x used to be but still rather easy. Here some sample code I used myself (create folders properly before using it)
我已经实现了新命令来实现 https://github.com/umpirsky/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Console/Command/GenerateEntitiesDbCommand.php
只需像这样添加
:));
$cli->run();
I have implemented new command to achieve that https://github.com/umpirsky/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Console/Command/GenerateEntitiesDbCommand.php
Just add it like this:
));
$cli->run();
自 https://github.com /doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php ,Doctrine的默认CLI已经支持生成实体
As of https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php , generating entities is already supported by Doctrine's default CLI