src/models/User.php
public function rules()
    {
        $module = UsersModule::module();
        $rules = [
            [
                ['phone'],
                'safe',
            ],
            [
                [
                    'password',
                ],
                'safe',
                'on' => self::SCENARIO_DEFAULT,
            ],
            [
                [
                    'password',
                ],
                'required',
                'on' => self::SCENARIO_PASSWORD_RESET,
            ],
            [
                'username',
                'unique',
            ],
            [
                'email',
                'unique',
            ],
            'standardEmailRules' => [
                [
                    'email',
                ],
                'email',
                'checkDNS' => $module->authorizationScenario()->emailCheckDNS,
                'enableIDN' => $module->authorizationScenario()->emailEnableIDN,
                'skipOnEmpty' => true,
                'on' => self::SCENARIO_PROFILE_UPDATE,
            ],
            'trimEmail' => [
                [
                    'email',
                ],
                'filter',
                'filter' => 'trim',
                'on' => self::SCENARIO_PROFILE_UPDATE,
            ],
            [
                [
                    'username_is_temporary',
                    'password_is_temporary',
                    'is_active',
                ],
                'filter',
                'filter' => 'boolval',
            ]
        ];
        $property_rules = $this->propertiesRules();
        if (!empty($property_rules)) {
            $rules = array_merge($rules, $property_rules);
        }
        if (count(UsersModule::module()->requiredUserAttributes) > 0) {
            $rules['requiredAttributes'] = [
                UsersModule::module()->requiredUserAttributes,
                'required',
                'on' => self::SCENARIO_PROFILE_UPDATE,
            ];
        }


        return $rules;
    }
public function rules()
    {
        $module = UsersModule::module();
        $rules = [
            [
                ['phone'],
                'safe',
            ],
            [
                [
                    'password',
                ],
                'safe',
                'on' => self::SCENARIO_DEFAULT,
            ],
            [
                [
                    'password',
                ],
                'required',
                'on' => self::SCENARIO_PASSWORD_RESET,
            ],
            [
                'username',
                'unique',
            ],
            [
                'email',
                'unique',
            ],
            'standardEmailRules' => [
                [
                    'email',
                ],
                'email',
                'checkDNS' => $module->authorizationScenario()->emailCheckDNS,
                'enableIDN' => $module->authorizationScenario()->emailEnableIDN,
                'skipOnEmpty' => true,
                'on' => self::SCENARIO_PROFILE_UPDATE,
            ],
            'trimEmail' => [
                [
                    'email',
                ],
                'filter',
                'filter' => 'trim',
                'on' => self::SCENARIO_PROFILE_UPDATE,
            ],
            [
                [
                    'username_is_temporary',
                    'password_is_temporary',
                    'is_active',
                ],
                'filter',
                'filter' => 'boolval',
            ]
        ];
        $property_rules = $this->propertiesRules();
        if (!empty($property_rules)) {
            $rules = array_merge($rules, $property_rules);
        }
        if (count(UsersModule::module()->requiredUserAttributes) > 0) {
            $rules['requiredAttributes'] = [
                UsersModule::module()->requiredUserAttributes,
                'required',
                'on' => self::SCENARIO_PROFILE_UPDATE,
            ];
        }


        return $rules;
    }
public function rules ( ) { $ module = UsersModule :: module ( ) ; $ rules = [ [ [ 'phone' ] , 'safe' , ] , [ [ 'password' , ] , 'safe' , 'on' => self :: SCENARIO_DEFAULT , ] , [ [ 'password' , ] , 'required' , 'on' => self :: SCENARIO_PASSWORD_RESET , ] , [ 'username' , 'unique' , ] , [ 'email' , 'unique' , ] , 'standardEmailRules' => [ [ 'email' , ] , 'email' , 'checkDNS' => $ module -> authorizationScenario ( ) -> emailCheckDNS , 'enableIDN' => $ module -> authorizationScenario ( ) -> emailEnableIDN , 'skipOnEmpty' => true , 'on' => self :: SCENARIO_PROFILE_UPDATE , ] , 'trimEmail' => [ [ 'email' , ] , 'filter' , 'filter' => 'trim' , 'on' => self :: SCENARIO_PROFILE_UPDATE , ] , [ [ 'username_is_temporary' , 'password_is_temporary' , 'is_active' , ] , 'filter' , 'filter' => 'boolval' , ] ] ; $ property_rules = $ this -> propertiesRules ( ) ; if ( ! empty ( $ property_rules ) ) { $ rules = array_merge ( $ rules , $ property_rules ) ; } if ( count ( UsersModule :: module ( ) -> requiredUserAttributes ) > 0 ) { $ rules [ 'requiredAttributes' ] = [ UsersModule :: module ( ) -> requiredUserAttributes , 'required' , 'on' => self :: SCENARIO_PROFILE_UPDATE , ] ; } return $ rules ; }
Validation rules for this model.
Validation rules for this model .