The Gitlab instance will be restarted on Monday April 28th at 2AM. There will be a short interruption of service.

Skip to content
Snippets Groups Projects
Commit acb63d7b authored by Demian Katz's avatar Demian Katz
Browse files

Eliminate static factory.

parent af503902
No related merge requests found
......@@ -343,7 +343,7 @@ $config = [
'VuFind\SessionManager' => 'VuFind\Session\ManagerFactory',
'VuFind\SessionPluginManager' => 'VuFind\Service\Factory::getSessionPluginManager',
'VuFind\SMS' => 'VuFind\SMS\Factory',
'VuFind\Solr\Writer' => 'VuFind\Service\Factory::getSolrWriter',
'VuFind\Solr\Writer' => 'VuFind\Solr\WriterFactory',
'VuFind\Tags' => 'VuFind\Service\Factory::getTags',
'VuFind\Translator' => 'VuFind\Service\Factory::getTranslator',
'VuFind\WorldCatUtils' => 'VuFind\Service\Factory::getWorldCatUtils',
......
......@@ -194,21 +194,6 @@ class Factory
return static::getGenericPluginManager($sm, 'Session');
}
/**
* Construct the Solr writer.
*
* @param ServiceManager $sm Service manager.
*
* @return \VuFind\Solr\Writer
*/
public static function getSolrWriter(ServiceManager $sm)
{
return new \VuFind\Solr\Writer(
$sm->get('VuFind\Search\BackendManager'),
$sm->get('VuFind\Db\Table\PluginManager')->get('changetracker')
);
}
/**
* Construct the tag helper.
*
......
<?php
/**
* Solr writer factory.
*
* PHP version 5
*
* Copyright (C) Villanova University 2018.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package Search
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
namespace VuFind\Solr;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
/**
* Solr writer factory.
*
* @category VuFind
* @package Search
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
class WriterFactory implements FactoryInterface
{
/**
* Create an object
*
* @param ContainerInterface $container Service manager
* @param string $requestedName Service being created
* @param null|array $options Extra options (optional)
*
* @return object
*
* @throws ServiceNotFoundException if unable to resolve the service.
* @throws ServiceNotCreatedException if an exception is raised when
* creating a service.
* @throws ContainerException if any other error occurs
*/
public function __invoke(ContainerInterface $container, $requestedName,
array $options = null
) {
if (!empty($options)) {
throw new \Exception('Unexpected options sent to factory.');
}
return new $requestedName(
$container->get('VuFind\Search\BackendManager'),
$container->get('VuFind\Db\Table\PluginManager')->get('changetracker')
);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment