Validator\ValidatorTypeGuesser (Component\Form\Extension)
Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser
class ValidatorTypeGuesser implements FormTypeGuesserInterface
Methods
__construct(MetadataFactoryInterface $metadataFactory) | ||
TypeGuess|null | guessType(string $class, string $property) Returns a field guess for a property name of a class. | |
ValueGuess | guessRequired(string $class, string $property) Returns a guess whether a property of a class is required. | |
ValueGuess|null | guessMaxLength(string $class, string $property) Returns a guess about the field's maximum length. | |
ValueGuess|null | guessPattern(string $class, string $property) Returns a guess about the field's pattern. | |
TypeGuess|null | guessTypeForConstraint(Constraint $constraint) Guesses a field class name for a given constraint. | |
ValueGuess|null | guessRequiredForConstraint(Constraint $constraint) Guesses whether a field is required based on the given constraint. | |
ValueGuess|null | guessMaxLengthForConstraint(Constraint $constraint) Guesses a field's maximum length based on the given constraint. | |
ValueGuess|null | guessPatternForConstraint(Constraint $constraint) Guesses a field's pattern based on the given constraint. |
Details
public __construct(MetadataFactoryInterface $metadataFactory)
public TypeGuess|null guessType(string $class, string $property)
Returns a field guess for a property name of a class.
public ValueGuess guessRequired(string $class, string $property)
Returns a guess whether a property of a class is required.
public ValueGuess|null guessMaxLength(string $class, string $property)
Returns a guess about the field's maximum length.
public ValueGuess|null guessPattern(string $class, string $property)
Returns a guess about the field's pattern.
- When you have a min value, you guess a min length of this min (LOW_CONFIDENCE) , lines below
- If this value is a float type, this is wrong so you guess null with MEDIUM_CONFIDENCE to override the previous guess. Example: You want a float greater than 5, 4.512313 is not valid but length(4.512314) > length(5)
public TypeGuess|null guessTypeForConstraint(Constraint $constraint)
Guesses a field class name for a given constraint.
public ValueGuess|null guessRequiredForConstraint(Constraint $constraint)
Guesses whether a field is required based on the given constraint.
public ValueGuess|null guessMaxLengthForConstraint(Constraint $constraint)
Guesses a field's maximum length based on the given constraint.
public ValueGuess|null guessPatternForConstraint(Constraint $constraint)
Guesses a field's pattern based on the given constraint.
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.html