drus39136 2014-01-11 17:21
浏览 24

如何在symfony框架中更好地组织控制器? [关闭]

I have a lot of controllers and I need to abstract all common behavior, so I want to know what is the best practice to organize it.

I think that will be organized if I put all my controllers in the controllers folder and create subfolders with abstract code respecting the semantic of name of context of each controller as convention.

  • 写回答

1条回答 默认 最新

  • douping7975 2014-01-11 21:47

    There shouldn't be very much common behavior between your controllers. If you do have duplicate code or common behavior, then it should probably be refactored out to a service. Thin controllers, fat models & services.

    Knp University has a really good (and free) screencast on the topic:


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



  • ¥15 微信夜间被转走了1w对,当天手机剪切板里就出现了这个乱码,有铁子可以看看是啥吗可以
  • ¥50 跑通github上的代码 深度学习 pytorch
  • ¥50 求写,批处理调用分区助手分区脚本
  • ¥15 求购HI3519AV100开发板
  • ¥15 请问1553 RT怎么测试,没有BC有方法吗
  • ¥100 业务编程如何选择学习方向和内容?
  • ¥15 wamp3.3.5安装完成后图标正常显示绿色,鼠标左右键点击图标均无反应。求解决方法。
  • ¥15 鼠标点击的这条记录了什么?
  • ¥15 在写pid调速的程序时,电机始终维持最大速度
  • ¥15 【有偿】调用DXGI截图初始化失败,提示0xf 887a0004