Exemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['phone', 'email'], 'required'], [['name', 'email'], 'string', 'max' => 50], ['name', 'required', 'when' => function ($model) {
         return $model->subject_id < 1;
     }], ['name', NameValidator::className(), 'when' => function ($model) {
         return $model->subject_id < 1;
     }], ['email', 'email'], ['phone', 'string', 'max' => 20], [['time_from', 'time_to'], 'integer', 'on' => self::SCENARIO_CREATE], ['time_from', 'compare', 'compareAttribute' => 'time_to', 'operator' => '<', 'type' => 'number', 'on' => self::SCENARIO_CREATE], ['repetition_end_date', 'date', 'format' => 'y-MM-dd', 'on' => self::SCENARIO_CREATE], ['repetition_end_date', DateToDateValidator::className(), 'compareAttribute' => 'date', 'operator' => '>=', 'on' => self::SCENARIO_CREATE], ['repetition', RepetitionValidator::className(), 'limitsAttributes' => ['time_from', 'time_to'], 'on' => self::SCENARIO_CREATE], ['notice', 'string'], [['date', 'subject_id'], 'safe'], [['device_id', 'hour_nr'], 'safe', 'on' => self::SCENARIO_UPDATE]];
 }
Exemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['date_from', 'date_to', 'time_from', 'time_to', 'hour_length'], 'required'], [['date_from', 'date_to'], 'date', 'format' => 'y-MM-dd'], ['date_from', DateToDateValidator::className(), 'compareAttribute' => 'date_to', 'operator' => '<'], ['date_to', PlanValidator::className(), 'firstAttribute' => 'date_from'], [['time_from', 'time_to'], 'date', 'format' => 'HH:mm'], ['hour_length', 'integer']];
 }
Exemplo n.º 3
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['firstDate', 'lastDate'], 'required'], [['firstDate', 'lastDate'], 'date', 'format' => 'y-MM-dd'], ['firstDate', DateFutureValidator::className()], [['firstDate', 'lastDate'], DatePlanValidator::className(), 'device_id' => $this->device->id], ['firstDate', DateToDateValidator::className(), 'compareAttribute' => 'lastDate', 'operator' => '<=']];
 }