Overriding Doctrine_Record (sfDoctrineRecord) instance methods in Doctrine PHP Symfony

后端 未结 4 1592
滥情空心
滥情空心 2021-02-09 01:16

My background is in Propel, so I was hoping it would be a simple thing to override a magical getter in a Doctrine_Record (sfDoctrineRecord), but I\'m getting either a Segfault o

4条回答
  •  离开以前
    2021-02-09 01:40

    This works:

    class FaqCategory extends BaseFaqCategory
    {
    
      public function __toString()
      {
        return $this->getCategory();
      }
    
      public function getDisplayName() {
    
        if($this->_get("display_name") != "") {
          $display_name = $this->_get("display_name");
        } else {
          $display_name = $this->getCategory();
        }
    
        return $display_name;
    
      }
    
    }
    

提交回复
热议问题