protected function importDatatypes(&$ids, &$errors, $children)
{
foreach ($children['children'] as $child) {
$attributes = $child->attributes();
$id = (int) $attributes['id'];
$model = Datatype\Model::fromId($id);
if ($model === false) {
$model = new Datatype\Model();
}
$name = (string) $child->name;
$datatypeModel = (string) $child->model;
$model->addData(array('name' => empty($name) ? $model->getName() : $name, 'model' => empty($datatypeModel) ? $model->getModel() : $datatypeModel));
$model->setPrevalueValue((string) $child->prevalue_value);
try {
if (!empty($model)) {
$model->save();
$ids['datatypes'][$id] = $model->getId();
}
} catch (Exception $e) {
$errors[] = sprintf($this->serviceLocator->get('MvcTranslator')->translate('Cannot save datatype with id (%d)'), $id);
}
}
}