You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a model, that uses several VO properties, using a ValueObjectInterface.
Trying to create a generic PropertyCaster, CastToValueObjectInterface, I miss the concrete Attribute target (the property on whom is applied) to hydrate the property without need to explicity add the class to be hydrated on the attribute
classNameimplementsValueObject {
publicfunctionfrom(mixed$value): self
}
final readonly classModel {
#[CastAsValueObject]
publicName$name
}
readonly classCastToValueObjectInterfaceimplementsPropertyCaster {
publicfunctioncast(mixed$value, ObjectMapper$hydrator, PropertyHydrationDefinition$context=null): mixed
{
if (!$context?->firstTypeName instanceOf ValueObject)
throw\InvalidArgumentException("Annotated property does not implement ValueObject");
return ($context->firstTypeName)::from($value);
}
}
The text was updated successfully, but these errors were encountered:
I've got a model, that uses several VO properties, using a ValueObjectInterface.
Trying to create a generic PropertyCaster, CastToValueObjectInterface, I miss the concrete Attribute target (the property on whom is applied) to hydrate the property without need to explicity add the class to be hydrated on the attribute
The text was updated successfully, but these errors were encountered: