__construct() public method

Entity constructor
public __construct ( )
示例#1
0
 function __construct()
 {
     parent::__construct();
     $this->attr('ip')->char();
     $this->attr('timestamp')->integer()->setDefaultValue(0);
     $this->attr('username')->char();
 }
示例#2
0
 public function __construct()
 {
     parent::__construct();
     $this->attr('rangeStart')->float();
     $this->attr('rangeEnd')->float();
     $this->attr('geoId')->integer();
 }
示例#3
0
 public function __construct()
 {
     parent::__construct();
     $this->attr('boolean')->boolean()->setValidators('required');
     $this->attr('char')->char()->setValidators('required');
     $this->attr('integer')->integer()->setValidators('required');
     $this->attr('float')->float()->setValidators('required');
     $this->attr('object')->object()->setKeyValidators(['key1' => 'required']);
     $this->attr('many2one')->many2one()->setEntity(Classes::MANY_2_ONE_VALIDATION)->setValidators('required');
     $this->attr('one2many')->one2many('entity')->setEntity(Classes::ONE_2_MANY_VALIDATION)->setValidators('required');
 }
示例#4
0
 function __construct()
 {
     parent::__construct();
     $this->attr('username')->char();
     $this->attr('loginAttempts')->arr();
     $this->attr('allowedDevices')->arr();
     $this->attr('sessions')->arr();
     $this->attr('blocked')->boolean()->setDefaultValue(false);
     $this->attr('confirmed')->boolean()->setDefaultValue(false);
     $this->attr('confirmationToken')->char();
     $this->attr('lastLogin')->integer();
     $this->attr('forgotPasswordToken')->char();
 }
示例#5
0
 public function __construct()
 {
     parent::__construct();
     $this->attr('char')->char()->setAfterPopulate()->onSet(function ($value) {
         return 'set-' . $this->number . '-' . $value;
     })->onGet(function ($value) {
         return 'get-' . $value;
     })->onToArray(function () {
         return ['key' => 'value'];
     })->onToDb(function ($value) {
         return 'db-' . $value;
     })->setToArrayDefault();
     $this->attr('number')->integer()->onFromDb(function ($value) {
         return $value * 10;
     });
 }
示例#6
0
 public function __construct()
 {
     parent::__construct();
     $this->attr('boolean')->boolean();
     $this->attr('char')->char()->setToArrayDefault();
     $this->attr('skip')->char()->setSkipOnPopulate();
     $this->attr('after')->char();
     $this->attr('calculation')->integer()->onGet(function ($value, $multiplier = 1) {
         return $value * $multiplier;
     });
     $this->attr('integer')->integer();
     $this->attr('float')->float()->onGet(function ($value, $x = null) {
         return $x ? 2 * $x : $value;
     });
     $this->attr('date')->date()->setToArrayDefault();
     $this->attr('datetime')->datetime()->setToArrayDefault();
     $this->attr('arr')->arr();
     $this->attr('object')->object();
     $this->attr('geoPoint')->geoPoint()->setToArrayDefault();
     $this->attr('dynamic')->dynamic(function () {
         return 'dynamic-value';
     })->setToArrayDefault();
     $this->attr('dynamicDb')->dynamic(function () {
         return 'dynamic-value-db';
     })->setStoreToDb()->setToArrayDefault();
     $this->attr('dynamicWithDefaultParams')->dynamic(function ($multiplier = 2) {
         return $this->integer * $multiplier;
     })->setToArrayDefault();
     $this->attr('dynamicWithParams')->dynamic(function ($multiplier = 1) {
         return $this->integer * $multiplier;
     });
     $this->attr('dynamicEntity')->dynamic(function () {
         return Many2One::findOne(['char' => 'many2oneNew']);
     })->setToArrayDefault();
     $this->attr('dynamicEntityCollection')->dynamic(function () {
         return Many2One::find();
     })->setToArrayDefault();
     $this->attr('many2oneNew')->many2one()->setEntity(Classes::MANY_2_ONE_NO_VALIDATION);
     $this->attr('many2oneExisting')->many2one()->setEntity(Classes::MANY_2_ONE_NO_VALIDATION);
     $this->attr('one2many')->one2many('entity')->setEntity(Classes::ONE_2_MANY_NO_VALIDATION);
     $this->attr('many2many')->many2many('NoValidation_Many2Many2Entity')->setEntity(Classes::MANY_2_MANY_NO_VALIDATION);
 }
示例#7
0
 public function __construct()
 {
     parent::__construct();
     $this->attr('char')->char()->setValidators('minLength:3,maxLength:5,in:abc:def');
     $this->attr('integer')->integer()->setValidators('integer,gt:2,lt:5');
     $this->attr('float')->float()->setValidators('gte:2,lte:5');
     $this->attr('object')->object()->setKeyValidators(['key1' => 'required', 'key2' => 'email']);
     $this->attr('geoPoint')->geoPoint();
     $this->attr('many2one')->many2one()->setEntity(Classes::MANY_2_ONE_VALIDATION);
     $this->attr('one2many')->one2many('entity')->setEntity(Classes::ONE_2_MANY_VALIDATION)->setValidators('minLength:2');
     $this->attr('many2many')->many2many('Whatever')->setEntity(Classes::MANY_2_MANY_NO_VALIDATION)->setValidators('minLength:2');
     $this->attr('vatNumber')->char()->setValidators('euVatNumber');
     $this->attr('creditCardNumber')->char()->setValidators('creditCardNumber');
     $this->attr('email')->char()->setValidators('email');
     $this->attr('number')->char()->setValidators('number');
     $this->attr('password')->char()->setValidators('password');
     $this->attr('url')->char()->setValidators('url');
     $this->attr('phone')->char()->setValidators('phone');
     $this->attr('regex')->char()->setValidators('regex:/^[-+0-9()]+$/');
     $this->attr('unique')->char()->setValidators('unique');
 }
示例#8
0
 public function __construct()
 {
     parent::__construct();
     $this->attr('char')->char()->setToArrayDefault();
     $this->attr('entity')->many2one()->setEntity(Classes::ENTITY_NO_VALIDATION);
 }
示例#9
0
 public function __construct()
 {
     parent::__construct();
     $this->attr('geoId')->integer()->attr("continentCode")->char()->attr("continentName")->char()->attr("countryCode")->char()->attr("countryName")->char()->attr("subdivision1Name")->char()->attr("subdivision1Code")->char()->attr("subdivision2Name")->char()->attr("subdivision2Code")->char()->attr("cityName")->char()->attr("timeZone")->char();
 }
示例#10
0
 public function __construct()
 {
     parent::__construct();
     $this->attr('char')->char()->setValidators('required');
 }
示例#11
0
 public function __construct()
 {
     parent::__construct();
     $this->attr('char')->char()->setValidators('required');
     $this->attr('entity')->many2one()->setEntity(Classes::ENTITY_VALIDATION);
 }