Zend Framework calling another Controller Action

倾然丶 夕夏残阳落幕 提交于 2019-12-06 10:04:29
tasmaniski

You have to move send mails functionality to another place, and call it in both methods.

Check this thread Calling member function of other controller in zend framework?

I suggest to create at the path /library a new folder 'My' and in it new file Utilities.php and in that file a new class where you can put all your help methods

class My_Utilities {
    // put here your custom help methods
}

You need to auto-load that namespace.In configs/application.ini put

autoloaderNamespaces.my = "My_"

Then you can use namespace My_ and class My_Utilities.


In any case, you can call method form another controller:

include 'NotifyController.php';
$a = new NotifyController($this->_request, $this->_response);
$a->notifyEmailAction();
$this->action('action', 'controller', 'module', 'params')

That view helper walk through frontController and dispatch all plugins again.

I think is not the best solution keep in mind wasting resources

sajish daniel

Please try this code $this->action("action","controller","module")

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!