Fix problem where Doctrine used the wrong state for new entities