CodeExplorer validateContextHasPermission example
private function map(array
$fields, DataStack
$stack, EntityExistence
$existence, WriteParameterBag
$parameters): array
{ foreach ($fields as $field) { $kvPair =
$this->
getKeyValuePair($field,
$stack,
$existence);
if ($kvPair === null
) { continue;
} try { if ($field->
is(WriteProtected::
class) && !
$kvPair->
isDefault()) { $this->
validateContextHasPermission($field,
$kvPair,
$parameters);
} $values =
$field->
getSerializer()->
encode($field,
$existence,
$kvPair,
$parameters);
foreach ($values as $fieldKey =>
$fieldValue) { $stack->
update($fieldKey,
$fieldValue);
} } catch (WriteFieldException
$e) { $parameters->
getContext()->
getExceptions()->
add($e);
} }