Fix undefined index error recomputing changesets for documents without one
Rewrite #897 fix and test to be consistent with ORM

This makes the test more in line with the corresponding ORM fix in doctrine/doctrine2@d473824279bfee19772bb1692d2a3453a2aff233. Our lifecycle callbacks to not yet receive event arguments, so the DocumentManager must be injected into the document manually (yes, this is a hack).
Merge pull request #897