2009/7/4 Václav Vaník <[email protected]>:
>
> Hi guys,
>
> i have suffering with modules setup in application.ini and Bootstrap.php
> file
>
> I tried Google, Nabble, manual, source codes... and nothing :(
>
> This is my app structure:
>
> application
> -- configs
> -- application.ini
> -- controllers
> -- IndexController.php
> -- models
> -- modules
> -- admin
> -- controllers
> -- views
> -- other-module
> -- views
> -- helpers
> -- scripts
> -- Bootstrap.php
>
> Settings in application.ini:
>
> [production]
> bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
> bootstrap.class = "Bootstrap"
>
> resources.frontController.controllerDirectory = APPLICATION_PATH
> "/controllers"
> resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
> resources.frontController.baseUrl = "/"
>
> resources.layout.layoutpath = APPLICATION_PATH "/layouts"
>
> resources.modules[] =
>
> admin.resources.db.adapter = "Pdo_Pgsql"
> admin.resources.db.isDefaultTableAdapter = true
> ; other db adapter settings
>
> But I have none db adapter stored in Zend_Registry in my admin module
You should be able to get it via:
$db = $this->getInvokeArg('bootstrap')
->getResource('modules')
->admin
->getResource('db');
1. Get the bootstrap from the front controller
2. Get the modules resource, this is an ArrayObject of the separate
module bootstraps
3. Access the module you want to access, admin
4. Get the db resource from this module
>
> Bootstrap.php:
>
> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
> {
> protected function _initAutoload()
> {
> $moduleLoader = new Zend_Application_Module_Autoloader(array(
> 'namespace' => '',
> 'basePath' => APPLICATION_PATH)
> );
> return $moduleLoader;
> }
> }
> --
> View this message in context:
> http://www.nabble.com/Bootstrap-and-modules-again-tp24335501p24335501.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>
--
----------------------------------------------------------------------
[MuTe]
----------------------------------------------------------------------