Skip to content

Instantly share code, notes, and snippets.

@popovserhii
Last active October 4, 2018 12:53
Show Gist options
  • Save popovserhii/c7c7074536f3018ea21e659efd4daab2 to your computer and use it in GitHub Desktop.
Save popovserhii/c7c7074536f3018ea21e659efd4daab2 to your computer and use it in GitHub Desktop.
ZF3 Override ServiceManager Config
protected function overrideServiceManagerConfig(ServiceManager $sm, array $appendConfig)
{
$globalConfig = $sm->get('Config');
$allConfig = \Zend\Stdlib\ArrayUtils::merge($globalConfig, $appendConfig);
// set Config service, service manager can't operate without it
$sm->setAllowOverride(true);
$sm->setService('Config', $allConfig);
$sm->setAllowOverride(false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment