I would like to create some class instances from php associative arrays. I need to create the object without calling the constructor, and then set its properties.
I was able to find the doctrine/instantiator, which does the object creation.
Unfortunately it is not able to set the properties. How is it possible? How does Doctrine hydrator solve this?
I could create a ReflectionClass
, get the reflectionProperty, call ->setAccessible(true)
, and then set the attribute. But for thousands of objects, this solution is too slow.