/** * Creates a fresh instance of the ResourceMetadataFactory. * * @return \BedRest\Resource\Mapping\ResourceMetadataFactory */ protected function createFactory() { $reader = new AnnotationReader(); $driver = new AnnotationDriver($reader); $driver->addPaths(array(TESTS_BASEDIR . '/BedRest/TestFixtures/Models', TESTS_BASEDIR . '/BedRest/TestFixtures/Models/Company')); return new ResourceMetadataFactory($driver); }
/** * Creates a ResourceMetadataFactory. * * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator * @return \BedRest\Resource\Mapping\ResourceMetadataFactory */ public function createService(ServiceLocatorInterface $serviceLocator) { $options = $serviceLocator->get('Config'); $options = $options['bedrest']; $driver = new ResourceAnnotationDriver(new AnnotationReader()); $driver->addPaths($options['resource_paths']); $cache = new ArrayCache(); return new ResourceMetadataFactory($driver, $cache); }
/** * Initialises the BedRest RestManager and associated dependencies. * * @param array $options */ protected function initRestManager(array $options) { $annotationReader = new AnnotationReader(); $driver = new ResourceAnnotationDriver($annotationReader); $driver->addPaths($this->restConfiguration->getResourcePaths()); $this->restConfiguration->setResourceMetadataDriverImpl($driver); $cache = new ArrayCache(); $this->restConfiguration->setResourceMetadataCacheImpl($cache); $this->restManager = new RestManager($this->restConfiguration); $this->restManager->setServiceManager($this->serviceManager); }