monk.e.boy wrote:
DBName_TableName == /apps/models/DBName/TableName.php (<-- would this work?)
Well, it would work in that you can declare a class that way. But how to use it? Since you said each controller knows its own database name, it should know how to instantiate "new DBName_TableName()". But if you're getting the name of the DB from a config file, then you don't really know the name of the DB until runtime.
You can also load Table classes by their simple table name, if you use set_include_path() to add "/apps/models/DBName".
monk.e.boy wrote:
Looking forward to some insigntful comments :-) ;-) (especially about my odd DB design
;-)
I can't comment on your choice of creating multiple databases, since I don't know why you did it that way. If you did it for master/slave failover, or for load-balancing, then that's fine. However, if you did it so you can have a different database "per" some attribute, then that's probably a self-defeating architecture.
You might be interested in declaring Table class with a schema-qualified name:
class MyTable extends Zend_Db_Table_Abstract
{
protected $_name = 'dbname.mytable';
}
There's also a $_schema class variable, but its implementation is spotty and it's not necessary anyway, since you can achieve the same result more reliably by specifying the schema-qualified name.
Regards,
Bill Karwin