Skip to content

Extend WpGet

Daniele Fontani edited this page Jan 30, 2018 · 1 revision

Add a filed to an entity

Into Table.php file into /src/db/ folder, edit

public function  getFieldDefinition()
{
  // add here field definition
}

Example

   public function  getFieldDefinition()
    { 
        return array(
            'reposlug' =>'string',
            'name' =>'string',
            'description'=>'string',
            'major'=>'integer',
            'minor'=>'integer',
            'build' =>'integer',
            'version' =>'string',            `
            'relativepath' =>'string'
        );
    }

where each field is based on convention:

fieldname => type

For type enumeration see eloquent type mapping. In fact, wpget use eloquent migration and types are mapped on eloquent column generation function (longText,text,smallInteger). See the full list