Zend Framework: Controller Plugins vs Action Helpers

后端 未结 5 712
不知归路
不知归路 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:12

    Controller plugins can hook into any controller at any point in the routing process (preDispatch postDispatch, routeStartup, routeShutdown) which makes them apt at providing behind the scenes functionality like ACL enforcement.

    Action Helpers are for for reusable but optional segments that your controller might need to access (redirector, flashMessenger).

    So if you are creating a reusable snippet of code that always needs to execute itself then use a controller plugin, otherwise you probably want an action helper.

提交回复
热议问题