2013-07-23 72 views
0
Table: 
    field_1: 
     type: decimal(6) 
     scale: 2 
     fixed: false 
     unsigned: true 
     notnull: true 
    field_2: 
     type: decimal(6) 
     scale: 2 
     fixed: false 
     unsigned: true 
     notnull: true 
     default: field_1 

有些文章告诉我,这是不可能的,我需要用PHP来做,但究竟在哪里?在lib> model> doctrine> base文件夹中?我脑海中的小声说:你没有别的选择:/Symfony 1.4 doctrine yml设置默认字段值与另一个字段的值

回答

0

好吧,在我睡好了之后,我明白了。这是lib下>模式>理论> Table.class.php

public function save(Doctrine_Connection $conn = null) { 
     if ($this->isNew() && !$this->getField2()) { 
      $this->setField2($this->getField1()); 
     } 
     return parent::save($conn); 
    } 

BUT!...这不符合我的阳明灯具工作。任何想法,使其与我的装置工作? [懒惰说话]。

+0

好的,因为没有更多的答案... –

相关问题