Zend Framework: Controller Plugins vs Action Helpers

后端 未结 5 595
不知归路
不知归路 2020-12-13 14:21

Could someone give few tips and/or examples how Controller Plugins and Action Helpers are different? Are there situations where particular task could be accomplished with on

5条回答
  •  囚心锁ツ
    2020-12-13 15:23

    You can think of it this way:

    • Action helpers are used to add methods to controllers.
    • Controller plugins are used to add routing / dispatch logic to controllers.

    So ask yourself, do I have a method that I would like to be able to call from all actions in my controller? Or do I need to add logic to the routing / dispatch process.

    You might also have a look at the the Built in Action Helpers.

提交回复
热议问题