【问题标题】:symfony 1.4: redeclared getter makes doctrine:data-load task fail silentlysymfony 1.4:重新声明的 getter 使学说:数据加载任务静默失败
【发布时间】:2011-08-08 07:22:01
【问题描述】:

这是我的架构的一部分:

sfGuardUser:
  actAs: [Timestampable]
  columns:
    email_address:
      type: string(255)
      notnull: true
      unique: true
    algorithm:
      type: string(128)
      default: sha1
      notnull: true
    salt: string(128)
    password: string(128)
    balance: 
      type: decimal(14)
      scale: 4
      default: 0
    guarantee:
      type: decimal(14)
      scale: 4
      default: 0
    is_active:
      type: boolean
      default: 1
    is_super_admin:
      type: boolean
      default: false
    last_login:
      type: timestamp

这是夹具数据:

sfGuardUser:
  User_admin_1:
    email_address:  admin@company.com
    password:       admin
    balance:        10000
    is_super_admin: true

这是导致失败的吸气剂

class sfGuardUser extends PluginsfGuardUser
{
  ... 

  public function getBalance()
  {
    return (parent::getBalance() - $this->getGuarantee());
  }
}

如果我删除 parent::getBalance() 一切正常。有什么问题?

【问题讨论】:

    标签: php symfony-1.4 fixtures doctrine-1.2


    【解决方案1】:

    最好致电$this->get('balance')$this->_get('balance') 获取Doctrine 的记录。这些函数检索理论模型中的值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-17
      • 2014-05-29
      • 1970-01-01
      • 1970-01-01
      • 2012-06-13
      • 2011-09-29
      相关资源
      最近更新 更多