I am trying to INSERT OR UPDATE IF EXISTS in one transaction.
INSERT OR UPDATE IF EXISTS
in mysql, I would generally use DUPLICATE KEY (\"UPDATE ON
DUPLICATE KEY
I think best way is to call entityManager->merge($entity); Because it's the closest thing to update if exist operation as promised in documentation: https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/working-with-objects.html