CakePHP Globally override class?

送分小仙女□ 提交于 2019-12-24 01:58:14

问题


I reconfigured my cakeEmail class to log to a specific type by rewriting the send method. I would like to use this override globally. My current single file setup uses /Lib/CustomCakeEmail.php with

App:uses('CustomCakeEmail', 'Lib');

CakePhp: Cake Email AfterSend event suggests a method to globally override using AppController but I have been unable to even trigger the debugger in

App::uses('CustomCakeEmail', 'Lib');
class AppController extends Controller {
    public function getEmailInstance($config = null) {
        CakeLog::write('debug', 'appcontroller triggered');
        return new CustomCakeEmail($config);
    }

What is the correct way to implement this global override?

CakePHP Version 2.8.4

来源:https://stackoverflow.com/questions/37326066/cakephp-globally-override-class

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