cache new object mappings
This commit is contained in:
parent
0fbb78e61a
commit
b29d47a682
@ -237,15 +237,17 @@ abstract class AbstractHydrator
|
|||||||
|
|
||||||
if (isset ($this->_rsm->newObjectMappings[$key])) {
|
if (isset ($this->_rsm->newObjectMappings[$key])) {
|
||||||
$cache[$key]['isNewObjectParameter'] = true;
|
$cache[$key]['isNewObjectParameter'] = true;
|
||||||
|
$cache[$key]['argIndex'] = $this->_rsm->newObjectMappings[$key]['argIndex'];
|
||||||
|
$cache[$key]['objIndex'] = $this->_rsm->newObjectMappings[$key]['objIndex'];
|
||||||
|
$cache[$key]['class'] = new \ReflectionClass($this->_rsm->newObjectMappings[$key]['className']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset ($cache[$key]['isNewObjectParameter'])) {
|
if (isset ($cache[$key]['isNewObjectParameter'])) {
|
||||||
$argIndex = $this->_rsm->newObjectMappings[$key]['argIndex'];
|
$argIndex = $cache[$key]['argIndex'];
|
||||||
$objIndex = $this->_rsm->newObjectMappings[$key]['objIndex'];
|
$objIndex = $cache[$key]['objIndex'];
|
||||||
$className = $this->_rsm->newObjectMappings[$key]['className'];
|
$rowData['newObjects'][$objIndex]['class'] = $cache[$key]['class'];
|
||||||
$rowData['newObjects'][$objIndex]['className'] = $className;
|
$rowData['newObjects'][$objIndex]['args'][$argIndex] = $cache[$key]['fieldName'];
|
||||||
$rowData['newObjects'][$objIndex]['args'][$argIndex] = $cache[$key]['fieldName'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($cache[$key]['isScalar'])) {
|
if (isset($cache[$key]['isScalar'])) {
|
||||||
|
@ -550,12 +550,11 @@ class ObjectHydrator extends AbstractHydrator
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($newObjects as $newObject) {
|
foreach ($newObjects as $newObject) {
|
||||||
$args = array();
|
$args = array();
|
||||||
$className = $newObject['className'];
|
$class = $newObject['class'];
|
||||||
foreach ($newObject['args'] as $index => $name) {
|
foreach ($newObject['args'] as $index => $name) {
|
||||||
$args[$index] = $result[$resultKey][$name];
|
$args[$index] = $result[$resultKey][$name];
|
||||||
}
|
}
|
||||||
$class = new \ReflectionClass($className);
|
|
||||||
$result[$resultKey] = $class->newInstanceArgs($args);
|
$result[$resultKey] = $class->newInstanceArgs($args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user