How to map a property that is an array of objects? #751
Replies: 3 comments
-
|
Hi @chuckadams this should work well. It looks like the PHPDoc is not read properly, maybe check for your PHP ini settings to see if there is an option that somehow "removes" them during runtime, or something like this? |
Beta Was this translation helpful? Give feedback.
-
|
Also, using |
Beta Was this translation helpful? Give feedback.
-
|
💡 Aha: it appears to be a consequence of doing this in a REPL -- specifically Laravel Tinker via the phpstorm plugin, but I suspect any psysh-based shell would have the same problem. If I add the autoloader line and run this from a file, it works as expected. If there's any way to make it work in a repl, that'd be wonderful, otherwise perhaps it's something to point out in the documentation? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to replace a DTO base class design with Valinor, but I'm running into a problem doing something really basic, and that's deserialize an array of objects. I was under the impression that the example code below would do it, but apparently it's not parsing the PHPdoc annotations at all.
In the DTO system, I needed an attribute, and I tried writing an
ArrayOfconverter attribute as well, but I could never make it trigger at all, let alone convert anything. I can paste that attempt if needed, but I'm wondering if I'm missing anything obvious?Beta Was this translation helpful? Give feedback.
All reactions