Example #1
0
 /**
  * Create a metadata manager instance
  * @param Configuration $config
  */
 public function __construct(Configuration $config)
 {
     $driver = $config->getMetadataDriverClass();
     $this->metaDataDriver = $driver::create($config->getPathsToConfigFiles());
     $this->metadataFactory = new MetadataFactory($this->metaDataDriver);
     if ($cache = $config->getMetadataCacheImpl()) {
         $this->metadataFactory->setCache($cache);
     }
 }
Example #2
0
 /**
  * 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);
     }
 }