public function guessType(string
$class, string
$property): ?TypeGuess
{ if (!
$ret =
$this->
getMetadata($class)) { return new TypeGuess(TextType::
class,
[], Guess::LOW_CONFIDENCE
);
} [$metadata,
$name] =
$ret;
if ($metadata->
hasAssociation($property)) { $multiple =
$metadata->
isCollectionValuedAssociation($property);
$mapping =
$metadata->
getAssociationMapping($property);
return new TypeGuess(EntityType::
class,
['em' =>
$name, 'class' =>
$mapping['targetEntity'
], 'multiple' =>
$multiple], Guess::HIGH_CONFIDENCE
);
} return match ($metadata->
getTypeOfField($property)) { Types::ARRAY,
Types::SIMPLE_ARRAY =>
new TypeGuess(CollectionType::
class,
[], Guess::MEDIUM_CONFIDENCE
),
Types::BOOLEAN =>
new TypeGuess(CheckboxType::
class,
[], Guess::HIGH_CONFIDENCE
),
Types::DATETIME_MUTABLE,
Types::DATETIMETZ_MUTABLE,