Skip to content

Instantly share code, notes, and snippets.

@Ocramius
Created July 26, 2013 14:39
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ocramius/6089360 to your computer and use it in GitHub Desktop.
Save Ocramius/6089360 to your computer and use it in GitHub Desktop.
Disabling BjyAuthorize when in console environment in a Zend Framework 2 Application
<?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;
@mtcocktail
Copy link

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);
}

@fabiopaiva
Copy link

Thanks @mtcocktail, your post helped me to find the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment