My question was asked before. I also would like to access to my global configs (config/{,*.}{global,local}.php) located in my personal libraries (in the vendor directory). The closest answer that I think I found is here. I created function in my class
public function getServiceConfig()
{
return array(
'factories' => array(
'funcservice' => function(\Zend\ServiceManager\ServiceLocatorInterface $sm) {
$config = $sm->get('config');
}
)
);
}
And it works however I can't figure out how to get anything from the result.
$config = $this->getServiceConfig();
print_r($config);
gives me
Array
(
[factories] => Array
(
[funcservice] => Closure Object
(
[this] => Tools\Model\StandartFuncs Object
(
[eventIdentifier:protected] => Zend\Mvc\Controller\AbstractActionController
[plugins:protected] =>
[request:protected] =>
[response:protected] =>
[event:protected] =>
[events:protected] =>
[serviceLocator:protected] =>
)
[parameter] => Array
(
[$sm] => <required>
)
)
)
)
and from $config = $this->getServiceConfig()->get('locales');
I get
Fatal error: Call to a member function get() on a non-object