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 was taking a look at the issues, but haven't found any similar, is there a way to map a string into a DateTime/DateTimeImmutable by default? I mean, I have the following entity:
classUserFilter
{
public ?string$email = null; // this is beeing auto mappedpublic ?array$roleIds = null; // this need to be handled with forMember, OKpublic ?DateTimeImmutable$createdAt = null; // Could this be mapped without a forMember?
}
And by using this mapper it results in a error, because the library is not able to determine a mapper for string to DateTimeImmutable of the createdAt property.
No, this is not possible currently. If you have multiple recurring properties (createdAt, changedAt, deletedAt, ...), you could use copyMapping.
I can see the usefulness though, in a more generic sense: if a mapping exists from source type A to destination type B, automatically apply it. I am afraid that this is not a trivial thing to implement, especially for this case, since we're mapping from a scalar value to an object, which is something that still needs to be implemented as well.
I like the idea and will leave this open as food for thought.
Hi,
I was taking a look at the issues, but haven't found any similar, is there a way to map a string into a DateTime/DateTimeImmutable by default? I mean, I have the following entity:
And by using this mapper it results in a error, because the library is not able to determine a mapper for string to DateTimeImmutable of the
createdAt
property.Of course I can add another
forMember
in order to map the string into aDateTimeImmutable
but seems repetitive to me, is there a way to automate?The text was updated successfully, but these errors were encountered: