加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 如何在Symfony2项目中组织捆绑包?

发布时间:2020-12-13 13:42:24 所属栏目:PHP教程 来源:网络整理
导读:我有这个家伙的确切问题: http://groups.google.com/group/symfony2/browse_thread/thread/cd35132cc6972f29 我会在这里复制粘贴它: I was wondering what different ways of organizing bundles within a project people are using. I seem to end up wit
我有这个家伙的确切问题: http://groups.google.com/group/symfony2/browse_thread/thread/cd35132cc6972f29

我会在这里复制粘贴它:

I was wondering what different ways of organizing bundles within a
project people are using.

I seem to end up with either one massive bundle for a project or a lot
of bundles which are closely related (dependant) to each other. eg;

I implemented my own user entity and login forms etc,but the users
are linked to an organization (with some functionality). Etc … It’s
mostly the entities that overlap a lot I guess …

Do you guys split them up or dump them all in the same bundle?

编辑: I don’t use bundles for app-specific code anymore.

就个人而言,我更喜欢每个应用程序的一个部分都有一个包.例如:

> UserBundle
> BlogBu??ndle
> ForumBundle
> JobBundle
> StoreBundle
>等

如果应用程序是几个功能的混杂,没有一个足够大,需要单独的应用程序和/或子域,这是可以的.但是,如果我正在开发一个大型网上应用程序,我的捆绑包将更加具体:

> UserBundle
> ProductBundle
> CartBundle
> SearchBundle
>愿望清单捆绑
>等

所以,我会说,这取决于项目的重点.什么只是一个项目的一个部分可能是另一个项目的核心功能.

而且我通常都有CommonBundle,其中包括全局CSS,图像,布局等所有常见内容.

后端组织至少还有两个选项:

>每个捆绑包都有自己的后端部分,或
>有一个大的后端捆绑.

我个人倾向于第一个选项,你可以在我的previous answer中阅读它,但有些人更喜欢为整个后端分别拥有一个 – 可能使用admin bundles中的一个.

顺便说一下,捆绑互联是完全可以的 – 你不必让它们彼此独立.例如,JMSDiExtraBundle取决于metadata库和JMSAopBundle,而JMSAopBundle依赖于cg-library.如果你试图保持bundle完全独立,你最终会得到一个巨大的单片一堆代码.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读