-
-
Couldn't load subscription status.
- Fork 571
Closed
Description
In IDType, you are checking that the value is a scalar and return a string value:
/**
* @param mixed $value
* @return string
*/
public function serialize($value)
{
if ($value === true) {
return 'true';
}
if ($value === false) {
return 'false';
}
if ($value === null) {
return 'null';
}
if (!is_scalar($value)) {
throw new InvariantViolation("ID type cannot represent non scalar value: " . Utils::printSafe($value));
}
return (string) $value;
}This is actually wrong as there is one more kind of value that could be valid: classes implementing __toString. For example you could have an ID implementing a Uuid class or even something more specific to your domain like UserId.
Metadata
Metadata
Assignees
Labels
No labels