/**
* Creates an instance of the Drest Manager using the passed configuration object
* Can also pass in a Event Manager instance
*
* @param EntityManager $em
* @param Configuration $config
* @param Event\Manager $eventManager
*/
private function __construct(EntityManager $em, Configuration $config, Event\Manager $eventManager)
{
$this->em = $em;
$this->config = $config;
$this->eventManager = $eventManager;
$this->service = new Service($this->em, $this);
// Router is internal and currently cannot be injected / extended
$this->router = new Router();
$this->metadataFactory = new MetadataFactory(Mapping\Driver\AnnotationDriver::create(new AnnotationReader(), $config->getPathsToConfigFiles()));
if ($cache = $config->getMetadataCacheImpl()) {
$this->metadataFactory->setCache($cache);
}
}