Home » Database » DB_DataObject » Bug #4287
Same-named tables from different databases don't generate different files
Details
| Submitted | 2005-05-05 16:58 UTC |
|---|---|
| From | douglas dot day at calendarsystems dot com |
| Status | Bogus |
| Package | DB_DataObject |
| PHP Version | 5.0.3 |
| OS | WinXP |
| Roadmaps | (Not assigned) |
Comments
[2005-05-05 16:58 UTC] douglas dot day at calendarsystems dot com
Description:
------------
If I have 2 tables in different databases that have the same name (in my case, tblCustomerInfo). If I auto-generate the classes for this table, it only creates one file, TblCustomerInfo.php.
This makes using a single config.ini file to autogenerate my tables impossible. I need to create 3 different files for my 3 different databases, and generate the files into subfolders. I also had to subclass DB_DataObjects into 3 different classes to load the config files for each different database. While this works, it is undesirable.
Maybe you could have an optional parameter to the factory() function to designate the database to pull from. Something like this:
$customer = DB_DataObjects::factory("tblCustomerInfo", "mydatabase");
Then you could auto-generate the filenames to include database name. Something like "[database]_[tablename].php"?
I could probably write a patch. What do you think?
Reproduce code:
---------------
; Configuration for databases
[DB_DataObject]
; db1, db2, and db3 all have a table named tblCustomerInfo.
database_db1 = "mssql://username:password@tcp(sql)/db1"
database_db2 = "mssql://username:password@tcp(sql)/db2"
database_db3 = "mssql://username:password@tcp(sql)/db3"
schema_location = c:/www/dataobjects/
class_location = c:/www/php_include/classes/dataobjects/autorewards/
require_prefix = dataobjects/autorewards/
class_prefix = DataObjects_
debug = 0
debug_ignore_updates = 0
dont_die = 0
dont_use_pear_sequences = 1
build_views = 0
Expected result:
----------------
3 different files for TblCustomerInfo.php
Actual result:
--------------
Only 1 file for TblCustomerInfo.php
[2005-05-17 14:15 UTC] douglas dot day at calendarsystems dot com
I overlooked bug #3765, which is so similar to this that I've deleted this report.
Thanks,
-Doug