If you write
$appunto->setOperatore($user->getUsername());
in the prePersist
function, it'll save it once you've pressed the save button, right before it's persisted in memory.
Try to set the operator on the appunto object in the __constructor()
function, and it'll show the username in the appunto
object.
Remember that you'll have to set the user for each subobjects
like $appunto->getSubObject()->setOperatore($user);