Replies: 2 comments 2 replies
-
|
Hi @dantleech, nice to see you're trying to integrate Valinor with Messenger. If you succeed, do you think it would be possible for you to integrate your development in https://github.com/CuyZ/Valinor-Bundle? Concerning your request, the library is currently not capable of detecting the generics of an object. It would require more runtime processing (which can quickly become heavy when working with heavy iterables/objects), and the API of the library would need a certain amount of work to be able to understand that, take for instance: /**
* @template T of object
*/
final class SomeClass
{
/** @var class-string<T> */
public string $name;
// …
}The system should be smart enough to infer Any thoughts on this? I'm not against trying to implement it, but this might be quite big. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the suggestion and discussion, but after giving it some thoughts I think it is not worth implementing in the library. I hope the discriminator option was enough for you. BTW, did it work out for Messenger? Or you had to use another (de)serializer? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
We are experimenting with using Valinor as a serializer for Symofny Messenger in order to save messages in JSON.
The tricky part is storing the type in the
Envelopeheader. The Symfony Serializer just does$object::class... but for Valinor our type isClass1<Class2>.Do you think it feasible to introduce a way to generate the string type for a concrete object?
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions