if (!
$elementModel instanceof DocumentElement
) { $elementModel =
new DocumentElement();
$elementModel->
setDocument($model);
} $elementModel->
fromArray($element);
$elements->
add($elementModel);
} $data['elements'
] =
$elements;
} else { $data['elements'
] =
$this->
createDocumentElements($model);
} break;
default:
break;
} $model->
fromArray($data);
try { $manager->
persist($model);