/** * Get a service manager. * * @return \Zend\ServiceManager\ServiceManager */ public function getServiceManager() { // Get parent service manager: $sm = parent::getServiceManager(); // Add database service: if (!$sm->has('DbTablePluginManager')) { $factory = new \VuFind\Db\Table\PluginManager(new \Zend\ServiceManager\Config(array('abstract_factories' => array('VuFind\\Db\\Table\\PluginFactory')))); $factory->setServiceLocator($sm); $sm->setService('DbTablePluginManager', $factory); } return $sm; }
/** * Get a service manager. * * @return \Zend\ServiceManager\ServiceManager */ public function getServiceManager() { // Get parent service manager: $sm = parent::getServiceManager(); // Add database service: if (!$sm->has('VuFind\\DbTablePluginManager')) { $dbFactory = new \VuFind\Db\AdapterFactory($sm->get('VuFind\\Config')->get('config')); $sm->setService('VuFind\\DbAdapter', $dbFactory->getAdapter()); $factory = new \VuFind\Db\Table\PluginManager(new \Zend\ServiceManager\Config(['abstract_factories' => ['VuFind\\Db\\Table\\PluginFactory'], 'factories' => ['resource' => 'VuFind\\Db\\Table\\Factory::getResource', 'user' => 'VuFind\\Db\\Table\\Factory::getUser']])); $factory->setServiceLocator($sm); $sm->setService('VuFind\\DbTablePluginManager', $factory); // Override the configuration so PostgreSQL tests can work: $sm->setAllowOverride(true); $sm->setService('config', ['vufind' => ['pgsql_seq_mapping' => ['comments' => ['id', 'comments_id_seq'], 'oai_resumption' => ['id', 'oai_resumption_id_seq'], 'resource' => ['id', 'resource_id_seq'], 'resource_tags' => ['id', 'resource_tags_id_seq'], 'search' => ['id', 'search_id_seq'], 'session' => ['id', 'session_id_seq'], 'tags' => ['id', 'tags_id_seq'], 'user' => ['id', 'user_id_seq'], 'user_list' => ['id', 'user_list_id_seq'], 'user_resource' => ['id', 'user_resource_id_seq']]]]); } return $sm; }