-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Description
The IdReader currently does not expose the actual property type, only the fact that it is an integer or not.
As binary UUID values are more and more used as identifiiers, why not expose the actual type so users of this reader can use that to determine if the value should be converted or not?
The constructor already call this:
'$idType = $classMetadata->getTypeOfField(current($ids));'
so why not store this in a property and expose it via
public function getIdType(): string
Shall I create a PR for this?
Example
EasyAdmin makes use of this idReader but has no access to the actual type, only that it is not an integer.
see: https://github.com/EasyCorp/EasyAdminBundle/pull/7210/files
It would be so much easier if a conversion could be attempted based on the return value of getIdType() instead of isIntId()
if (false === $options['id_reader']->isIntId()) {
$data['autocomplete'] = array_map(
fn ($v) => Ulid::isValid($v) ? Ulid::fromBase32($v)->toRfc4122() : $v,
$data['autocomplete']
);
}