Created
July 26, 2013 14:39
-
-
Save Ocramius/6089360 to your computer and use it in GitHub Desktop.
Disabling BjyAuthorize when in console environment in a Zend Framework 2 Application
This file contains 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
<?php | |
use Zend\Console\Console; | |
$config = array( | |
'modules' => array( | |
'Application', | |
'DoctrineModule', | |
'DoctrineORMModule', | |
// ... | |
'BjyAuthorize' => 'BjyAuthorize', | |
), | |
'module_listener_options' => array( | |
'config_glob_paths' => array( | |
'config/autoload/{,*.}{global,local}.php', | |
), | |
'module_paths' => array( | |
'./module', | |
), | |
//'config_cache_enabled' => true, | |
//'config_cache_key' => 'module_config_cache', | |
//'cache_dir' => __DIR__ . '/../data/cache', | |
), | |
); | |
if (Console::isConsole()) { | |
unset ($config['modules']['BjyAuthorize']); | |
} | |
return $config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you don't put alias 'BjyAuthorize' => 'BjyAuthorize' but simply 'BjyAuthorize' you can write :
if (Console::isConsole()) {
array_splice($config['modules'],array_search('BjyAuthorize',$config['modules']),1);
}