public function rewriteIds($object, $idMapping, $params = [])
{
$data = $this->getDataFromObjectParam($object, $params);
if (is_array($data)) {
foreach ($data as &$metaObject) {
$eo = $metaObject->getObject();
if ($eo instanceof Element\ElementInterface) {
$id = $eo->getId();
$type = Element\Service::getElementType($eo);
if (array_key_exists($type, $idMapping) && array_key_exists($id, $idMapping[$type])) {
$newElement = Element\Service::getElementById($type, $idMapping[$type][$id]);
$metaObject->setObject($newElement);
}
}
}
}
return $data;
}