Fixing postFlush event for doctrine >= 2.4

Squash and correct the shouze's PR : https://github.com/rezzza/ModelViolationLoggerBundle/pull/8

It is a better way to handle the infinite loop problems.