Ejemplo n.º 1
0
 public function rules()
 {
     return [[['apikey'], 'required'], [['apikey'], 'exist', 'targetClass' => User::className(), 'targetAttribute' => 'api_key'], [['lobby'], 'exist', 'targetClass' => Lobby::className(), 'targetAttribute' => 'key'], [['rule'], 'exist', 'targetClass' => Rule::className(), 'targetAttribute' => 'key'], [['map'], 'exist', 'targetClass' => Map::className(), 'targetAttribute' => 'key'], [['weapon'], 'exist', 'targetClass' => Weapon::className(), 'targetAttribute' => 'key'], [['rank', 'rank_after'], 'exist', 'targetClass' => Rank::className(), 'targetAttribute' => 'key'], [['rank_exp', 'rank_exp_after'], 'integer', 'min' => 0, 'max' => 99], [['level', 'level_after'], 'integer', 'min' => 1, 'max' => 50], [['result'], 'boolean', 'trueValue' => 'win', 'falseValue' => 'lose'], [['cash', 'cash_after'], 'integer', 'min' => 0, 'max' => 9999999], [['rank_in_team'], 'integer', 'min' => 1, 'max' => 4], [['kill', 'death'], 'integer', 'min' => 0], [['death_reasons'], 'validateDeathReasons'], [['fest_gender'], 'in', 'range' => ['boy', 'girl']], [['fest_rank'], 'filter', 'filter' => 'strtolower'], [['fest_rank'], 'exist', 'targetClass' => FestTitle::className(), 'targetAttribute' => 'key'], [['my_team_color', 'his_team_color'], 'validateTeamColor'], [['image_judge', 'image_result'], 'safe'], [['image_judge', 'image_result'], 'file', 'maxSize' => 3 * 1024 * 1024, 'when' => function ($model, $attr) {
         return !is_string($model->{$attr});
     }], [['image_judge', 'image_result'], 'validateImageFile', 'when' => function ($model, $attr) {
         return !is_string($model->{$attr});
     }], [['image_judge', 'image_result'], 'validateImageString', 'when' => function ($model, $attr) {
         return is_string($model->{$attr});
     }], [['start_at', 'end_at'], 'integer'], [['agent'], 'string', 'max' => 64], [['agent_version'], 'string', 'max' => 255], [['agent', 'agent_version'], 'required', 'when' => function ($model, $attr) {
         return (string) $this->agent !== '' || (string) $this->agent_version !== '';
     }], [['my_point'], 'integer', 'min' => 0], [['my_team_final_point', 'his_team_final_point'], 'integer', 'min' => 0], [['my_team_final_percent', 'his_team_final_percent'], 'number', 'min' => 0.0, 'max' => 100.0], [['knock_out'], 'boolean', 'trueValue' => 'yes', 'falseValue' => 'no'], [['my_team_count', 'his_team_count'], 'integer', 'min' => 0, 'max' => 100], [['lobby'], 'fixLobby']];
 }
Ejemplo n.º 2
0
 public function rules()
 {
     return [[['apikey'], 'required'], [['apikey'], 'exist', 'targetClass' => User::className(), 'targetAttribute' => 'api_key'], [['test'], 'in', 'range' => ['validate', 'dry_run']], [['lobby'], 'exist', 'targetClass' => Lobby::className(), 'targetAttribute' => 'key'], [['rule'], 'exist', 'targetClass' => Rule::className(), 'targetAttribute' => 'key'], [['map'], 'exist', 'targetClass' => Map::className(), 'targetAttribute' => 'key'], [['weapon'], 'exist', 'targetClass' => Weapon::className(), 'targetAttribute' => 'key'], [['rank', 'rank_after'], 'exist', 'targetClass' => Rank::className(), 'targetAttribute' => 'key'], [['rank_exp', 'rank_exp_after'], 'integer', 'min' => 0, 'max' => 99], [['level', 'level_after'], 'integer', 'min' => 1, 'max' => 50], [['result'], 'boolean', 'trueValue' => 'win', 'falseValue' => 'lose'], [['cash', 'cash_after'], 'integer', 'min' => 0, 'max' => 9999999], [['rank_in_team'], 'integer', 'min' => 1, 'max' => 4], [['kill', 'death'], 'integer', 'min' => 0], [['death_reasons'], 'validateDeathReasons'], [['gender'], 'in', 'range' => ['boy', 'girl']], [['fest_title', 'fest_title_after'], 'filter', 'filter' => 'strtolower'], [['fest_title', 'fest_title_after'], 'filter', 'filter' => function ($a) {
         switch ($a) {
             case 'campion':
                 return 'champion';
             case 'friend':
                 return 'fiend';
             default:
                 return $a;
         }
     }], [['fest_title', 'fest_title_after'], 'exist', 'targetClass' => FestTitle::className(), 'targetAttribute' => 'key'], [['fest_exp', 'fest_exp_after'], 'integer', 'min' => 0, 'max' => 99], [['my_team_color', 'his_team_color'], 'validateTeamColor'], [['image_judge', 'image_result'], 'safe'], [['image_judge', 'image_result'], 'file', 'maxSize' => 3 * 1024 * 1024, 'when' => function ($model, $attr) {
         return !is_string($model->{$attr});
     }], [['image_judge', 'image_result'], 'validateImageFile', 'when' => function ($model, $attr) {
         return !is_string($model->{$attr});
     }], [['image_judge', 'image_result'], 'validateImageString', 'when' => function ($model, $attr) {
         return is_string($model->{$attr});
     }], [['start_at', 'end_at'], 'integer'], [['agent'], 'string', 'max' => 64], [['agent_version'], 'string', 'max' => 255], [['agent', 'agent_version'], 'required', 'when' => function ($model, $attr) {
         return (string) $this->agent !== '' || (string) $this->agent_version !== '';
     }], [['agent_custom'], 'string'], [['agent', 'agent_version', 'agent_custom'], 'validateStrictUTF8'], [['automated'], 'boolean', 'trueValue' => 'yes', 'falseValue' => 'no'], [['automated'], 'estimateAutomatedAgent', 'skipOnEmpty' => false], [['my_point'], 'integer', 'min' => 0], [['my_team_final_point', 'his_team_final_point'], 'integer', 'min' => 0], [['my_team_final_percent', 'his_team_final_percent'], 'number', 'min' => 0.0, 'max' => 100.0], [['knock_out'], 'boolean', 'trueValue' => 'yes', 'falseValue' => 'no'], [['my_team_count', 'his_team_count'], 'integer', 'min' => 0, 'max' => 100], [['players'], 'validatePlayers'], [['gears'], 'validateGears'], [['events'], 'validateEvents']];
 }
Ejemplo n.º 3
0
 public function rules()
 {
     return [[['team', 'is_me'], 'required'], [['team'], 'in', 'range' => ['my', 'his']], [['is_me'], 'boolean', 'trueValue' => 'yes', 'falseValue' => 'no'], [['weapon'], 'exist', 'targetClass' => Weapon::className(), 'targetAttribute' => 'key'], [['rank'], 'exist', 'targetClass' => Rank::className(), 'targetAttribute' => 'key'], [['level'], 'integer', 'min' => 1, 'max' => 50], [['rank_in_team'], 'integer', 'min' => 1, 'max' => 4], [['kill', 'death'], 'integer', 'min' => 0], [['point'], 'integer', 'min' => 0]];
 }
Ejemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRankAfter()
 {
     return $this->hasOne(Rank::className(), ['id' => 'rank_after_id']);
 }
Ejemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRanks()
 {
     return $this->hasMany(Rank::className(), ['id_aposta' => 'id']);
 }