Skip to content
Snippets Groups Projects
Commit 234813e0 authored by Dorian Merz's avatar Dorian Merz
Browse files

Merge branch 'master' into instance/fid

parents a5aa531c dc283573
No related merge requests found
......@@ -88,6 +88,11 @@ $config = [
'finctheca' => 'finc\ILS\Driver\FincTheca',
'finclibero' => 'finc\ILS\Driver\FincLibero'
],
'delegators' => [
'finc\ILS\Driver\FincLibero' => [
'finc\ILS\Driver\StaticStatusRulesDelegatorFactory'
]
]
],
'recommend' => [
'factories' => [
......
......@@ -137,12 +137,16 @@ class Factory
/**
* Factory for FincLibero driver.
*
* @param \Psr\Container\ContainerInterface $container Service manager.
* @param ContainerInterface $container Service manager
* @param string $requestedName Service being created
* @param null|array $options Extra options (optional)
*
* @return object
*
* @return FincLibero
*/
public static function getFincLibero(ContainerInterface $container)
{
public static function getFincLibero(ContainerInterface $container, $requestedName,
array $options = null
) {
$factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory($container->get('VuFind\ProxyConfig'));
$callback = function (& $wrapped, $proxy) use ($container) {
......@@ -151,7 +155,7 @@ class Factory
$proxy->setProxyInitializer(null);
};
$fl = new FincLibero(
$fl = new $requestedName(
$container->get('VuFind\DateConverter'),
$container->get('VuFind\SessionManager'),
$container->get('VuFind\RecordLoader'),
......@@ -164,8 +168,7 @@ class Factory
$container->get('VuFind\CacheManager')->getCache('object')
);
$fl->staticStatusRules = $container->get('VuFind\YamlReader')->get('StaticStatusRules.yaml');
return $fl;
}
}
<?php
/**
* Munger Injection Factory
*
* A Delegator Factory that registers several listeners at events triggered by the
* VuFind\Search service.
*
* PHP version 7
*
* Copyright (C) Leipzig University Library 2019.
*
* 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 Finc/Service
* @author Dorian Merz <merz@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org Main Page
*/
namespace finc\ILS\Driver;
use Interop\Container\ContainerInterface;
use VuFindSearch\Query\Query;
use VuFindSearch\Query\QueryGroup;
use VuFindSearch\Service as SearchService;
use Zend\Config\Config;
use Zend\EventManager\EventInterface;
use Zend\ServiceManager\Factory\DelegatorFactoryInterface;
/**
* Munger Injection Factory
*
*
* @category VuFind
* @package Finc/ILS
* @author Dorian Merz <merz@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org Main Page
*/
class StaticStatusRulesDelegatorFactory implements DelegatorFactoryInterface
{
/**
* Adds staticStatusRules if there is a valid StaticStatusRules.json available
*
* @param ContainerInterface $container
* @param string $name
* @param callable $callback
* @param array|null $options
*
* @return mixed
*/
public function __invoke(
ContainerInterface $container,
$name,
callable $callback,
array $options = null
) {
$instance = call_user_func($callback);
$staticStatusRules = $container->get('VuFind\YamlReader')->get('StaticStatusRules.yaml');
if (!empty($staticStatusRules)) {
if (isset($staticStatusRules['rules']) && isset($staticStatusRules['stopFlags'])) {
$instance->staticStatusRules = $staticStatusRules;
}
}
return $instance;
}
}
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