CodeExplorer executeCommands example
/**
* {@inheritdoc}
*/
public function execute(array
$commands, WriteContext
$context): void
{ $beforeWriteEvent = EntityWriteEvent::
create($context,
$commands);
$this->eventDispatcher->
dispatch($beforeWriteEvent);
try { RetryableTransaction::
retryable($this->connection,
function D
) use ($commands,
$context): void
{ $this->
executeCommands($commands,
$context);
});
$beforeWriteEvent->
success();
} catch (\Throwable
$e) { $event =
new WriteCommandExceptionEvent($e,
$commands,
$context->
getContext());
$this->eventDispatcher->
dispatch($event);
$beforeWriteEvent->
error();
throw $e;
} }