私のバックグラウンドは Propel にあるので、Doctrine_Record (sfDoctrineRecord) で魔法のゲッターをオーバーライドするのは簡単なことだと思っていましたが、Segfault を取得しているか、オーバーライド メソッドが単純に無視されて、スーパークラス。
https://gist.github.com/697008eaf4d7b606286a
class FaqCategory extends BaseFaqCategory
{
public function __toString()
{
return $this->getCategory();
}
// doesn't work
// override getDisplayName to fall back to category name if getDisplayName doesn't exist
public function getDisplayName() {
// also tried parent::getDisplayName() but got segfault(!)
if(isset($this->display_name)) {
$display_name = $this->display_name;
} else {
$display_name = $this->category;
}
return $display_name;
}
}
Doctrine_Record のインスタンスでメソッドを拡張/オーバーライドする適切な Doctrine の方法は何ですか? (sfDoctrineRecord を介して Doctrine_Record を拡張します)? これは実行可能である必要があります...または、テンプレートのドキュメントを確認する必要がありますか?
ありがとう、ブライアン