/** * @inheritDoc */ public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { /** @var ExtendedSolrFactoryHelper $extendedTargetHelper */ $extendedTargetHelper = $serviceLocator->getServiceLocator()->get('Swissbib\\ExtendedSolrFactoryHelper'); $this->defaultNamespace = $extendedTargetHelper->getNamespace($name, $requestedName); return parent::canCreateServiceWithName($serviceLocator, $name, $requestedName); }
/** * Create a service for the specified name. * * @param ServiceLocatorInterface $serviceLocator Service locator * @param string $name Name of service * @param string $requestedName Unfiltered name of service * * @return object */ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { $options = $serviceLocator->getServiceLocator()->get('VuFind\\SearchOptionsPluginManager')->get($requestedName); if ($name === 'solr' || $name == 'solrauthor') { // Clone the options instance in case caller modifies it: return new \Finna\Search\Solr\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config'), $serviceLocator->getServiceLocator()->get('VuFind\\DateConverter')); } elseif ($name === 'primo') { // Clone the options instance in case caller modifies it: return new \Finna\Search\Primo\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config')); } elseif ($name === 'metalib') { // Clone the options instance in case caller modifies it: return new \Finna\Search\MetaLib\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config')); } elseif ($name === 'combined') { // Clone the options instance in case caller modifies it: return new \Finna\Search\Combined\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config'), $serviceLocator->getServiceLocator()->get('VuFind\\DateConverter')); } elseif ($name === 'mixedlist') { // Clone the options instance in case caller modifies it: return new \Finna\Search\MixedList\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config')); } elseif ($name === 'favorites') { // Clone the options instance in case caller modifies it: return new \Finna\Search\Favorites\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config')); } elseif ($name === 'emptyset') { // Clone the options instance in case caller modifies it: return new \Finna\Search\EmptySet\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config')); } return parent::createServiceWithName($serviceLocator, $name, $requestedName); }
/** * Create a service for the specified name. * * @param ServiceLocatorInterface $serviceLocator Service locator * @param string $name Name of service * @param string $requestedName Unfiltered name of service * * @return object */ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { $options = $serviceLocator->getServiceLocator()->get('VuFind\\SearchOptionsPluginManager')->get($requestedName); if ($name === 'solr') { // Clone the options instance in case caller modifies it: return new \Finna\Search\Solr\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config')); } else { if ($name === 'primo') { // Clone the options instance in case caller modifies it: return new \Finna\Search\Primo\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config')); } else { if ($name === 'combined') { // Clone the options instance in case caller modifies it: return new \Finna\Search\Combined\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config')); } } } return parent::createServiceWithName($serviceLocator, $name, $requestedName); }