Symfony2 - find out loaded document classNames in DocumentManager

Written by Marco Leong

Digged into the source code to find out how to list all the documents mapped in a document manager.

$classNames = $documentManager //DocumentManager
    ->getConfiguration()
    ->getMetadataDriverImpl()
    ->getAllClassNames();