init() public method

Extend this method to define fields of your choice.
public init ( )
Ejemplo n.º 1
0
 public function init()
 {
     parent::init();
     $this->addField('name');
     $this->addField('surname');
     $this->addField('gender', ['enum' => ['M', 'F']]);
 }
Ejemplo 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']);
 }
Ejemplo 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);
 }
Ejemplo 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']]);
 }
Ejemplo n.º 5
0
 public function init()
 {
     parent::init();
     $this->addField('type', ['enum' => ['client', 'supplier']]);
     $this->addField('name');
 }
Ejemplo n.º 6
0
 public function init()
 {
     parent::init();
     $this->addField('name');
     $this->hasMany('Payment', new Payment())->addField('balance', ['aggregate' => 'sum', 'field' => 'amount']);
 }
Ejemplo n.º 7
0
 public function init()
 {
     parent::init();
     $this->addField('name');
     $this->addField('surname');
 }