public function init() { parent::init(); $this->addField('name'); $this->hasMany('Payment', new Payment())->addField('balance', ['aggregate' => 'sum', 'field' => 'amount']); }