如何使用Symfony flex使用Symfony 3.4生成文档 [英] How to generate document with Symfony 3.4 using Symfony flex
问题描述
使用Symfony flex,更改之一是使用symfony/skeleton时没有默认捆绑软件.
With Symfony flex, one of the change is that there is no default bundle when using the symfony/skeleton.
在这种情况下,我找不到使用doctrine:mongodb:generate:documents命令的方法.
I don't find a way to use the command doctrine:mongodb:generate:documents in this context.
您能告诉我如何使用它吗?
Could you please tell me how to use it ?
示例:
php bin\console doctrine:mongodb:generate:documents App
2018-02-17T18:35:22+00:00 [error] Error thrown while running command "doctrine:mongodb:generate:documents AppBundle --document Test". Message: "No bundle AppBundle was found."
In DoctrineODMCommand.php line 87:
No bundle AppBundle was found.
doctrine:mongodb:generate:documents [--document [DOCUMENT]] [--no-backup] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> <bundle>
这就是我设置项目的方式
This is how I setup my project
composer create-project symfony/skeleton:3.4 test
composer config "platform.ext-mongo" "1.6.16" && composer require "alcaeus/mongo-php-adapter"
composer require doctrine/mongodb-odm-bundle
谢谢
此致
克里斯
推荐答案
教义orm和doctrine:generate:entities
也存在类似的问题. Doctrine团队不鼓励用户使用这些命令,因此不再希望对其进行维护.
There is a similar issue with doctrine orm and doctrine:generate:entities
. The Doctrine team discourages users from using these commands and therefore does no longer want to maintain them.
我认为到目前为止,最简单的解决方法是:
I think the easiest workaround I've seen so far is:
- 使用Symfony安装程序创建Symfony 3.3样式的应用程序.
- 像以前一样在AppBundle中生成实体
- 将名称空间从
AppBundle
更改为App
. - 将文件移动到Symfony 4项目中.
- Create a Symfony 3.3 style application using the Symfony installer.
- Generate the entities in the AppBundle as you did before
- Change the namespace from
AppBundle
toApp
. - Move the files into your Symfony 4 project.
一些Symfony团队还着手在中提供类似的代码生成. MakerBundle .据我所知,没有什么可以生成ODM风格的实体,但是您可以自己提出一个问题或为此做出贡献.
Some of the Symfony team also set out to provide similar code generation in a MakerBundle. As far as I can tell there is nothing for generating ODM-style entities, but you could open an issue or contribute something for this yourself.
有关参考,请参见: https://github.com/doctrine/DoctrineBundle/issues/729
这篇关于如何使用Symfony flex使用Symfony 3.4生成文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!