Symfony 2 + Doctrine 2覆盖实体配置 [英] Symfony 2 + Doctrine 2 overriding entity configuration

查看:92
本文介绍了Symfony 2 + Doctrine 2覆盖实体配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要在多个应用程序(驻留在同一个项目中)重用常用原则实体的情况。这些应用只是相应机构使用的信息系统的实例。

I have a case where I need to reuse common doctrine entities across multiple applications (that reside within the same project). These applications are merely instances of information system used by corresponding institutions.

我将所有实体和存储库分离成单独的包,到目前为止,它的工作就像一个魅力。 这是catch:我已经收到一个要求,只有一些这些实例需要支持其他功能。修改将包括向某些实体添加新的归属/关系。

I've isolated all entities and repositories into separate bundle and that worked like a charm so far. Here's the catch: I have received a requirement that only some of these instances need to support some other features. Modification would include adding new attributed/relations to some of entities.

这是一个简单的例子:

我们有一所大学有多个教师单位(实例,是)。信息系统的建立仅支持本科研究计划,但一个月前,我们也获得了支持专业化主要研究的要求。他们想要处理所有他们认为相同的应用程序实例。 这仅适用于其中某些实例

We have a university which has number of faculty units (instances, that is). Information system was built to support only bachelor studies program but a month ago we received requirement to support specialization and master studies as well. They want to handle all the them thought the same application instance. This applies only to some of these instances.

问题:有没有办法覆盖受影响实体,同时保持原有的功能?我可以覆盖实体配置(YAML或注释,不重要)吗?我真的希望保留代码库,而不是将所有的实体/存储库复制到另一个包...

The question: Is there any way to "override" affected entities while keeping functionality of original ones? Can I override entity configuration (YAML or annotation, not important), at all? I would really like to keep the code base and not to copy all the entities/repositories to another package...

推荐答案

我不知道这个是什么意思。看起来有可能但还没有记录。我不知道文档或代码是否在进行中。

I don't know what this means. Looks like it is possible but not documented yet. I don't whether the documentation or the code is in progress.

在这个问题上,stof表示这是不可能的。

In this issue, stof suggests it is not possible at all.

我认为你应该使用SCM分支。

I think you should use SCM branches for this.

这篇关于Symfony 2 + Doctrine 2覆盖实体配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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