Can't override CakeEmail class and use deliver

When using TemplateEmail::deliver it always create new instance of CakeEmail, I assume it should create my extended "TemplateEmail" class insted.

PHP >5.3 compatible
This commit is contained in:
kolorafa 2016-06-13 18:02:26 +02:00 committed by GitHub
parent d352b5f14d
commit 449e5fc9cf

View file

@ -1203,7 +1203,7 @@ class CakeEmail {
* @throws SocketException
*/
public static function deliver($to = null, $subject = null, $message = null, $transportConfig = 'fast', $send = true) {
$class = __CLASS__;
$class = get_called_class();
/** @var CakeEmail $instance */
$instance = new $class($transportConfig);
if ($to !== null) {