private function cloneEntity( EntityDefinition
$definition,
string
$id,
string
$newId,
string
$versionId,
WriteContext
$context,
CloneBehavior
$behavior,
bool
$writeAuditLog = false
): array
{ $criteria =
new Criteria([$id]);
$this->
addCloneAssociations($definition,
$criteria,
$behavior->
cloneChildren());
$detail =
$this->entityReader->
read($definition,
$criteria,
$context->
getContext())->
first();
if ($detail === null
) { throw DataAbstractionLayerException::
cannotCreateNewVersion($definition->
getEntityName(),
$id);
} $data =
json_decode($this->serializer->
serialize($detail, 'json'
), true, 512, \JSON_THROW_ON_ERROR
);
$keepIds =
$newId ===
$id;