library/Garp/Spawn/Config/Validator/Model/Abstract.php
protected function _validateUniqueKeyLength(ArrayObject $config) {
        $restrictedFieldTypes = array('text', 'html');

        if (array_key_exists('inputs', $config)) {
            foreach ($config['inputs'] as $inputName => $input) {
                if (
                    array_key_exists('unique', $input) &&
                    $input['unique'] &&
                    (
                        (
                            !array_key_exists('type', $input) &&
                            !Garp_Spawn_Util::stringEndsIn('email', $inputName) &&
                            !Garp_Spawn_Util::stringEndsIn('url', $inputName) &&
                            !Garp_Spawn_Util::stringEndsIn('id', $inputName) &&
                            !Garp_Spawn_Util::stringEndsIn('date', $inputName) &&
                            !Garp_Spawn_Util::stringEndsIn('time', $inputName)
                        ) ||
                        (
                            array_key_exists('type', $input) &&
                            in_array($input['type'], $restrictedFieldTypes)
                        )
                    ) &&
                    (
                        !array_key_exists('maxLength', $input) ||
                        $input['maxLength'] > 255
                    )
                ) {
                    throw new Exception("You've set {$config['id']}.{$inputName} to unique, but this type of field has to have a maxLength of 255 at most to be made unique.");
                }
            }
        }
    }
protected function _validateUniqueKeyLength(ArrayObject $config) {
        $restrictedFieldTypes = array('text', 'html');

        if (array_key_exists('inputs', $config)) {
            foreach ($config['inputs'] as $inputName => $input) {
                if (
                    array_key_exists('unique', $input) &&
                    $input['unique'] &&
                    (
                        (
                            !array_key_exists('type', $input) &&
                            !Garp_Spawn_Util::stringEndsIn('email', $inputName) &&
                            !Garp_Spawn_Util::stringEndsIn('url', $inputName) &&
                            !Garp_Spawn_Util::stringEndsIn('id', $inputName) &&
                            !Garp_Spawn_Util::stringEndsIn('date', $inputName) &&
                            !Garp_Spawn_Util::stringEndsIn('time', $inputName)
                        ) ||
                        (
                            array_key_exists('type', $input) &&
                            in_array($input['type'], $restrictedFieldTypes)
                        )
                    ) &&
                    (
                        !array_key_exists('maxLength', $input) ||
                        $input['maxLength'] > 255
                    )
                ) {
                    throw new Exception("You've set {$config['id']}.{$inputName} to unique, but this type of field has to have a maxLength of 255 at most to be made unique.");
                }
            }
        }
    }
protected function _validateUniqueKeyLength ( ArrayObject $ config ) { $ restrictedFieldTypes = array ( 'text' , 'html' ) ; if ( array_key_exists ( 'inputs' , $ config ) ) { foreach ( $ config [ 'inputs' ] as $ inputName => $ input ) { if ( array_key_exists ( 'unique' , $ input ) && $ input [ 'unique' ] && ( ( ! array_key_exists ( 'type' , $ input ) && ! Garp_Spawn_Util :: stringEndsIn ( 'email' , $ inputName ) && ! Garp_Spawn_Util :: stringEndsIn ( 'url' , $ inputName ) && ! Garp_Spawn_Util :: stringEndsIn ( 'id' , $ inputName ) && ! Garp_Spawn_Util :: stringEndsIn ( 'date' , $ inputName ) && ! Garp_Spawn_Util :: stringEndsIn ( 'time' , $ inputName ) ) || ( array_key_exists ( 'type' , $ input ) && in_array ( $ input [ 'type' ] , $ restrictedFieldTypes ) ) ) && ( ! array_key_exists ( 'maxLength' , $ input ) || $ input [ 'maxLength' ] > 255 ) ) { throw new Exception ( "You've set {$config['id']}.{$inputName} to unique, but this type of field has to have a maxLength of 255 at most to be made unique." ) ; } } } }
Throw a warning when a field is set to unique, while its maxLength is too large.
Throw a warning when a field is set to unique while its maxLength is too large .