-
-
Notifications
You must be signed in to change notification settings - Fork 69
Nested Objects #46
Comments
Possibly duplicate of #45 ? |
Might be a duplicate. |
@Norcoen shouldn't be. Can you write an example script with just |
Sry, I don't think I can extract all of the things I'm using. Can you provide an example of #45's "pass hydrator as property value"? I don't understand what and to whom I'd have to pass it. Right now I have this: $exampleClassName = "classA";
$config = new Configuration($exampleClassName );
$hydratorClass = $config->createFactory()->getHydratorClass();
$hydrator = new $hydratorClass();
$tmp = $this->getSampleObject();
$tmp2 = $hydrator->extract($tmp);
foreach ($tmp2 as $key => $possibleObj) {
if (is_object($possibleObj)) {
$nestedClassName = get_class($possibleObj);
var_dump($key, $nestedClassName);
$config = new Configuration($nestedClassName);
$hydratorClass = $config->createFactory()->getHydratorClass();
$hydrator = new $hydratorClass();
$tmp2[$key] = $hydrator->extract($possibleObj);
}
}
var_dump($tmp2); Works for the first level, so I could do it recursively, possibly with array_walk_recursive(), but even the first level takes ages, because the object has properties like "parent", taking this to infinity. |
You are also re-generating the hydrators all the time there :-\ |
+1 |
I'm getting NULL for nested objects, is it possible do use this recursively?
The text was updated successfully, but these errors were encountered: