What @oszust002 was referring to is the CommandContextUtil from which you can get access to the ExecutionEntityManager via CommandContextUtil.getExecutionEntityManager and then do CommandContextUtil.getExecutionEntityManager(task.getProcessInstnaceId())
Cheers,
Filip