public function __construct(DocumentManager $dm)
{
$this->dm = $dm;
$config = $this->dm->getConfiguration();
$this->setCacheDriver($config->getMetadataCacheImpl());
$this->driver = $config->getMetadataDriverImpl();
if (!$this->driver) {
throw new \RuntimeException('No metadata driver was configured.');
}
}