diff --git a/module/VuDL/config/module.config.php b/module/VuDL/config/module.config.php index d70fbba40e4662d9f6b1a31be59eb3976e0907ba..db271ba6c473e44eba436e72302f4f559cdc9a19 100644 --- a/module/VuDL/config/module.config.php +++ b/module/VuDL/config/module.config.php @@ -9,23 +9,10 @@ $config = array( ), 'service_manager' => array( 'factories' => array( - 'VuDL\Connection\Manager' => function ($sm) { - return new \VuDL\Connection\Manager( - array('Solr', 'Fedora'), $sm - ); - }, - 'VuDL\Connection\Fedora' => function ($sm) { - return new \VuDL\Connection\Fedora( - $sm->get('VuFind\Config')->get('VuDL') - ); - }, - 'VuDL\Connection\Solr' => function ($sm) { - return new \VuDL\Connection\Solr( - $sm->get('VuFind\Config')->get('VuDL'), - $sm->get('VuFind\Search\BackendManager')->get('Solr') - ); - } - ) + 'VuDL\Connection\Manager' => array('VuDL\Factory', 'getConnectionManager'), + 'VuDL\Connection\Fedora' => array('VuDL\Factory', 'getConnectionFedora'), + 'VuDL\Connection\Solr' => array('VuDL\Factory', 'getConnectionSolr'), + ), ), 'vufind' => array( 'plugin_managers' => array( diff --git a/module/VuDL/src/VuDL/Factory.php b/module/VuDL/src/VuDL/Factory.php index 9d42fe838e5bc6e47cc4d5ee091ecc8a4b0ac540..9d1b3afddd6a529876981d73a71716a649789a9c 100644 --- a/module/VuDL/src/VuDL/Factory.php +++ b/module/VuDL/src/VuDL/Factory.php @@ -40,15 +40,46 @@ use Zend\ServiceManager\ServiceManager; class Factory { /** - * Construct the Fedora service. + * Construct the Connection Manager service. * * @param ServiceManager $sm Service manager. * * @return Fedora */ - public static function getFedora(ServiceManager $sm) + public static function getConnectionManager(ServiceManager $sm) { - return new \VuDL\Fedora($sm->get('VuFind\Config')->get('VuDL')); + return new \VuDL\Connection\Manager( + array('Solr', 'Fedora'), $sm + ); + } + + /** + * Construct the Connection Fedora service. + * + * @param ServiceManager $sm Service manager. + * + * @return Fedora + */ + public static function getConnectionFedora(ServiceManager $sm) + { + return new \VuDL\Connection\Fedora( + $sm->get('VuFind\Config')->get('VuDL') + ); + } + + /** + * Construct the Connection Solr service. + * + * @param ServiceManager $sm Service manager. + * + * @return Fedora + */ + public static function getConnectionSolr(ServiceManager $sm) + { + return new \VuDL\Connection\Solr( + $sm->get('VuFind\Config')->get('VuDL'), + $sm->get('VuFind\Search\BackendManager')->get('Solr') + ); } /**