Simple, Slowly

ブログを引っ越ししました。http://48.jp

cakaPHP1.3でQdmailを使えるようにする

cakePHP からメールを送信するときはQdmail が便利です。

2011年1月26日時点での最新版 (1.2.6b)を
CakePHP 1.3以降で使うときは少々修正がいるようです。

そのまま使うとこういうエラーが出ます。

Fatal error: Call to undefined method View::renderElement() in /***/app/controllers/components/qdmail.php on line 3823

CakePHP 1.2 まで使われていた
View::renderElement() は1.3で廃止されて、
代わりに View::element() を使うことになっているようです。

1.2から1.3への移行ガイド :: 付録 :: マニュアル :: 1.3コレクション :: The Cookbook


該当箇所は3823行目にあるここです。

$content = $view->renderElement( $this->view_dir . DS . $type . DS . $this->template , array('content' => $content ) , true );
以下のように修正。

$content = $view->element( $this->view_dir . DS . $type . DS . $this->template , array('content' => $content ) , true );

これで問題なく動くようになりました。