Skip to content

Commit

Permalink
dbadapteraware initializer, and loading of extra modules by domain
Browse files Browse the repository at this point in the history
  • Loading branch information
nigel lundsten committed Apr 17, 2013
1 parent a0c667e commit aa71f8d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.modules.php
7 changes: 7 additions & 0 deletions module/Application/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
'factories' => array(
'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
),
'initializers' => array(
function ($instance, $sm) {
if ($instance instanceof Zend\Db\Adapter\AdapterAwareInterface) {
return $instance->setDbAdapter($sm->get('Zend\Db\Adapter\Adapter'));
}
}
),
),
'translator' => array(
'locale' => 'en_US',
Expand Down
9 changes: 8 additions & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@
// Setup autoloading
include 'init_autoloader.php';

$config = include 'config/application.config.php';
$host = $_SERVER['HTTP_HOST'];
$file = 'config/' . $host . '.modules.php';
if (file_exists($file)) {
$config = \Zend\Stdlib\ArrayUtils::merge($config, include $file);
}

// Run the application!
Zend\Mvc\Application::init(include 'config/application.config.php')->run();
Zend\Mvc\Application::init($config)->run();

0 comments on commit aa71f8d

Please sign in to comment.