init() public method

Extend this method to define fields of your choice.
public init ( )
Esempio n. 1
0
 public function init()
 {
     parent::init();
     $this->addField('name');
     $this->addField('surname');
     $this->addField('gender', ['enum' => ['M', 'F']]);
 }
Esempio n. 2
0
 public function init()
 {
     parent::init();
     // Documest is sent from one Contact to Another
     $this->hasOne('contact_from_id', new Contact());
     $this->hasOne('contact_to_id', new Contact());
     $this->addField('doc_type', ['enum' => ['invoice', 'payment']]);
     $this->addField('amount', ['type' => 'money']);
 }
Esempio n. 3
0
 public function init()
 {
     parent::init();
     $this->addField('name');
     $this->hasMany('SubFolder', [new self(), 'their_field' => 'parent_id'])->addField('count', ['aggregate' => 'count', 'field' => $this->expr('*')]);
     $this->hasOne('parent_id', new self())->addTitle();
     $this->addField('is_deleted', ['type' => 'boolean']);
     $this->addCondition('is_deleted', false);
 }
Esempio n. 4
0
 public function init()
 {
     parent::init();
     // Company data is stored in 3 tables actually.
     $j_contractor = $this->join('contractor');
     $j_company = $j_contractor->join('company.contractor_id', ['prefix' => 'company_']);
     $j_contractor->addFields([['name', 'actual' => 'legal_name']]);
     $j_company->addFields([['business_start', 'type' => 'date'], ['director_name'], ['vat_calculation_type', 'enum' => ['cash', 'invoice']]]);
     $this->addFields([['is_vat_registered', 'type' => 'boolean']]);
 }
Esempio n. 5
0
 public function init()
 {
     parent::init();
     $this->addField('type', ['enum' => ['client', 'supplier']]);
     $this->addField('name');
 }
Esempio n. 6
0
 public function init()
 {
     parent::init();
     $this->addField('name');
     $this->hasMany('Payment', new Payment())->addField('balance', ['aggregate' => 'sum', 'field' => 'amount']);
 }
Esempio n. 7
0
 public function init()
 {
     parent::init();
     $this->addField('name');
     $this->addField('surname');
 }