-- iceangel89 <[email protected]> wrote (on Thursday, 30 April 2009, 08:56 PM -0700): > Matthew Weier O'Phinney-3 wrote: > > -- iceangel89 <[email protected]> wrote > > > and in general how do i create a mapping from > > > > > > resources.db.adapter = "pdo_mysql" > > > resources.db.params.host = "localhost" > > > resources.db.params.username = "root" > > > resources.db.params.password = "" > > > resources.db.params.dbname = "zf-ims" > > > > > > to code like > > > > > > new Zend_Db(...)? > > > > > > is there documentation for this? > > > > I'm not sure what you're gettting at. You cannot instantiate Zend_Db > > directly, and the Db resource creates your adapter for you already. > > > > You can retrieve that adapter in a couple of ways: > > > > * From Zend_Db_Table_Abstract: > > $db = Zend_Db_Table_Abstract::getDefaultAdapter(); > > > > * Within your action controller, you can pull it from the bootstrap, > > which is available as an invocation arg: > > $bootstrap = $this->getInvokeArg('bootstrap'); > > $db = $bootstrap->getResource('db'); > > i meant, like how do i know that resources.db will do something like $db = > Zend_Db::factory(...)
Because that's how it's documented, and you can look at the source code itself to see this. :) > then resources.db.params. ... will set the 2nd args of the factory function? > with this infomation i can easily convert what we can do in Bootstrap.php > and put it in application.ini instead Yes, that's exactly how it works. The adapter parameter is used for the first argument to the factory, and the params for the second argument. > like now i didnt know that resources.router will refer to say the default > router > > then resources.router.routes. will add a route etc? Yes, of course it does. It pulls the router from the front controller, and then passes the routes in the configuration to the router in order to create them. -- Matthew Weier O'Phinney Project Lead | [email protected] Zend Framework | http://framework.zend.com/
