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

Inject configuration to record router.

parent ca42d499
No related merge requests found
...@@ -174,7 +174,10 @@ $config = array( ...@@ -174,7 +174,10 @@ $config = array(
}, },
'VuFind\Mailer' => 'VuFind\Mailer\Factory', 'VuFind\Mailer' => 'VuFind\Mailer\Factory',
'VuFind\RecordRouter' => function ($sm) { 'VuFind\RecordRouter' => function ($sm) {
return new \VuFind\Record\Router($sm->get('VuFind\RecordLoader')); return new \VuFind\Record\Router(
$sm->get('VuFind\RecordLoader'),
$sm->get('VuFind\Config')->get('config')
);
}, },
'VuFind\RecordStats' => function ($sm) { 'VuFind\RecordStats' => function ($sm) {
return new \VuFind\Statistics\Record( return new \VuFind\Statistics\Record(
......
...@@ -45,14 +45,23 @@ class Router ...@@ -45,14 +45,23 @@ class Router
*/ */
protected $loader; protected $loader;
/**
* VuFind configuration
*
* @var \Zend\Config\Config
*/
protected $config;
/** /**
* Constructor * Constructor
* *
* @param \VuFind\Record\Loader $loader Record loader * @param \VuFind\Record\Loader $loader Record loader
*/ */
public function __construct(\VuFind\Record\Loader $loader) public function __construct(\VuFind\Record\Loader $loader,
{ \Zend\Config\Config $config
) {
$this->loader = $loader; $this->loader = $loader;
$this->config = $config;
} }
/** /**
...@@ -88,9 +97,8 @@ class Router ...@@ -88,9 +97,8 @@ class Router
// to check if the driver is actually a collection; if so, we should switch // to check if the driver is actually a collection; if so, we should switch
// routes. // routes.
if ('record' == $route['route']) { if ('record' == $route['route']) {
$config = \VuFind\Config\Reader::getConfig(); if (isset($this->config->Collections->collections)
if (isset($config->Collections->collections) && $this->config->Collections->collections
&& $config->Collections->collections
) { ) {
if (!is_object($driver)) { if (!is_object($driver)) {
list($source, $id) = explode('|', $driver, 2); list($source, $id) = explode('|', $driver, 2);
......
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