开发者

symfony 1.4: redeclared getter makes doctrine:data-load task fail silently

Here is my part of my schema:

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

Here is fixture data:

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

Here is getter which make it fail

class sfGuardUser extends PluginsfGuardUser
{
  ... 

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

If I remove parent::getBalance() everything works fine. What's trouble with开发者_StackOverflow中文版 it ?


It's better to call $this->get('balance') or $this->_get('balance') to get a record from Doctrine. These functions retrieve the value in the doctrine model.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜