简体   繁体   English

Symfony2具有相同配置的多个捆绑软件

[英]Symfony2 multiple bundles with same configuration

I have one bundle, WebDificilBundle which is fully working, now, I want to make a second bundle named WebUserBundle , I want to make this bundle to be some kind of "between" for multiple bundles, so I need entities from WebUserBundle to be exactly the same, and by the same I don't mean the sctructure, I mean to use the entities from other bundles (this example WebDificilBundle ) 我有一个捆绑包, WebDificilBundle可以正常使用,现在,我要制作另一个名为WebUserBundle捆绑包,我想使该捆绑包成为多个捆绑包之间的某种“中间”,因此我需要WebUserBundle实体准确相同,同样,我不是要使用结构,而是要使用其他捆绑软件中的实体(此示例WebDificilBundle

How can I make this work? 我该如何进行这项工作? Just copying entities folder from one to another? 只是将实体文件夹从一个复制到另一个?

Option A - Use the same entities. 选项A-使用相同的实体。 It doesn't make any sense to copy the same entities into the second bundle. 将相同的实体复制到第二个捆绑包中没有任何意义。 Just use them. 只需使用它们。 Add the line YourProject/WebDificilBundle/Entity/yourentity.php in the controllers/services/whatever of WebUserBundle and use them normally. 在控制器/服务/任何WebUserBundle中添加行YourProject / WebDificilBundle / Entity / yourentity.php并正常使用它们。

Option B - I suppose you want to make as independent as possible both bundles, to be able to reuse them separetly in other projects. 选项B-我想您想使两个捆绑包尽可能独立,以便能够在其他项目中分别重用它们。 In that case, you can copy the entities in WebUserBundle. 在这种情况下,您可以复制WebUserBundle中的实体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM