我想答案是否定的,但我想确定一下。 SensioGeneratorBundle 包含生成实体的命令。您知道它是否可以为 one2Many 或 Many2Many 字段生成映射吗?有没有实现这个的项目?
我找到的唯一例子:
php app/console doctrine:generate:entity --entity=AcmeBlogBundle:Blog/Post --format=annotation --fields="title:string(255) body:text" --with-repository --no-interaction
非常感谢
最佳答案
我知道这是旧的...但这可以帮助一些人。
这是一个可以生成 Doctrine 2 关联的 Symfony3 包,包括一对多关系:
https://github.com/Remg/GeneratorBundle
Associations
- Handles all Doctrine2 association types (OneToOne, OneToMany, ManyToOne, ManyToMany).
- Handles unidirectional and bidirectional associations.
关于php - Symfony2 能否生成 :doctrine:entity generate entity with one-to-many relationship?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21004347/