dpy3846 2015-01-22 11:16
浏览 22
已采纳

Symfony2捆绑包应该包含什么?

I know a Symfony2 bundle should contain a common set of features. However, how granular do you define that set of features? For example, I have a ContentBundle which deals with creating and editing content. Then I have a TaxonomyBundle which handles tagging and categories etc. Finally I have a PollsBundle, which deals with polls.

The trouble I'm having is that the doctrine entities rely on entities in other bundles. For example I have an entity 'Type' in TaxonomyBundle, and a 'Poll' in PollBundle belongs to 'Type'. Finally 'Type' belongs to 'Content' in the ContentBundle.

Am I being too granular when trying to separate concerns? Should things like content and taxonomy be a part of the same bundle?

tl;dr how wide a scope, in terms of features should a Symfony2 bundle be?

  • 写回答

1条回答 默认 最新

  • dsfsdfsdfsdfsdf45454 2015-01-22 11:21
    关注

    According to Symfony best practices :

    But a bundle is meant to be something that can be reused as a stand-alone piece of software. If UserBundle cannot be used "as is" in other Symfony apps, then it shouldn't be its own bundle. Moreover InvoiceBundle depends on ProductBundle, then there's no advantage to having two separate bundles.

    So it looks that in your case this rule applies:

    Best Practice

    Create only one bundle called AppBundle for your application logic

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求指导ADS低噪放设计
  • ¥15 CARSIM前车变道设置
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存