Doctrine MongoDB ODM

Undefined index exception when a new document is detatched in onFlush