Added a test case for GitHub issue #560
Refactor test for #560 to use an event subscriber
Dispatch postPersist callbacks/events for upserted documents (fixes #560)

Previously postPersist lifecycle callbacks and events were only dispatched (and cascaded) for documents that were batch inserted (i.e. documents whose ID needed to be generated). This change splits up the post-insert processing (essentially the inline registerManaged() call) and event dispatching, so that upserted documents are always handled.

Additionally, DocumentPersister::executeInserts() was changed to always return an array, even if no documents were scheduled. This is consistent with its documentation and shaves some code from the calling context.
Refactor UnitOfWork::cascadePostPersist()

Some object calisthenic improvements.
Optimize class lookups if mapping has targetDocument defined

This should prevent unnecessary DocumentManager::getClassMetadata() lookups for most cases.
Merge pull request #601 from doctrine/gh560

Dispatch postPersist callbacks/events for upserted documents