我在ZF上设置了Doctrine 2,并将我的实体位置放在自定义库目录中。 如果我将实体移动到子文件夹中,这是否会导致连锁效应/错误?
I'm setup with Doctrine 2 on ZF, and have my entities location in my custom library directory. If I move the entities into subfolders, will this cause a knock-on effect/error?
最满意答案
主要问题应该是自动加载。 但是,如果您修改了新名称空间和位置的自动加载器配置,那么您应该没问题。 类似的考虑也适用于存储库。
请注意,属于您的Doctrine配置(可能是在Bootstrap中创建的)的元数据驱动程序实现需要指向包含元数据的文件夹。 如果您将实体中的注释用作元数据,那么这里需要使用新的实体路径。
另一种可能性是自动生成代理。 如果代理的位置发生变化,那么执行自动加载的任何进程都需要知道该位置。
只需注意一些事情。
Primary issue should be autoloading. But if you modify the autoloader config for your new namespaces and locations, then you should be fine. A similar consideration applies also to repositories.
Note that the metadata-driver-implementation that is part of your Doctrine config (probably created at Bootstrap) needs to point to a folder containing your metadata. If you are using annotations in your entities as your metadata, then the new entity path will need to be used here.
Another possibility is auto-generating of proxies. If the location of your proxies changes, then whatever process performs the autoloading needs to know that.
Just some things to look out for.
更多推荐
发布评论