Last active
October 4, 2018 12:53
-
-
Save popovserhii/c7c7074536f3018ea21e659efd4daab2 to your computer and use it in GitHub Desktop.
ZF3 Override ServiceManager Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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