I am not sure that is the best place to put it. That would then create
a dependency in Zend_Db to Zend_Registry. Putting things in the
registry is specifically the role of Zend_Application's resource
containers, without a really strong argument, it's really hard to
deviate from that concept.
-ralph
Douglas Hammond wrote:
Looking more into the code maybe the right place to add this would be to
the Zend_Db::factory and and passing a param that would register the
created db in the registry wether it be assigned to the name passed in
or some sort of database registry.
Being able yo pass in the registry entry to bind to would probably be
the most flexible.
So adding something to Zend_Db:factory after the adapter is created like
if(isset($config['registryEntry'])) {
Zend_Registry::set($config['registryEntry'],
$dbAdapter);
}
Then you should be able to do something like
resources.multidb.db1.registyEntry = db1
Then in setting up the session handler you cab just pass db1 as the db
and it should pull it from the registry
The issue here too would be that the db and multidb resources will have
to be bootstrapped before the session
On 2010-02-02, at 2:39 PM, Ralph Schindler-2 [via Zend Framework
Community] wrote:
> I like this idea, ..., but have you thought if there is a backward
> compatible way of adding this behavior to the existing Db resource?
>
> like
>
> resources.db.multidb = 1
> resources.db.multidb.default = "db1"
>
> resources.db.db1.dbname =
> resources.db.db1.params.xxx =
> resources.db.db2.dbname =
> resources.db.db2.params.xxx =
>
> Just a thought.. what do you think?
>
> Douglas Hammond wrote:
>
> >
> > I believe the Zend_Application_Resource_Multidb should have a param to
> > register the dbname in the registry so that setting up classes like
> > Zend_Session_SaveHandler_DbTable can select what db to use.
> >
> > Right now if you use multidb and use
Zend_Application_Resource_Session with
> > Zend_Session_SaveHandler_DbTable you cannot specify via
configuration only
> > to use one of the non-default dbs setup using MultiDb.
> >
> > For example application.ini below will not work as db2 is not
registered in
> > the zend_registry
> >
> > resources.multidb.db1.dbname = "db1"
> > resources.multidb.db1.default = true
> > ..
> >
> > resources.multidb.db2.dbname = "db2"
> > ...
> >
> > resources.session.use_only_cookies = true
> > resources.session.remember_me_seconds = 864000
> > resources.session.saveHandler.class =
"Zend_Session_SaveHandler_DbTable"
> > resources.session.saveHandler.options.db = "db2"
> > resources.session.saveHandler.options.name = "session"
> > resources.session.saveHandler.options.primary = "id"
> > resources.session.saveHandler.options.modifiedColumn = "modified"
> > resources.session.saveHandler.options.dataColumn = "data"
> > resources.session.saveHandler.options.lifetimeColumn = "lifetime"
> >
>
>
> View message @
http://n4.nabble.com/Zend-Application-Resource-Multidb-tp1460058p1460289.html
> To unsubscribe from Zend_Application_Resource_Multidb, click here.
>
------------------------------------------------------------------------
View this message in context: Re: Zend_Application_Resource_Multidb
<http://n4.nabble.com/Zend-Application-Resource-Multidb-tp1460058p1460340.html>
Sent from the Zend Framework mailing list archive
<http://n4.nabble.com/Zend-Framework-f634138.html> at Nabble.com.