Skip to content

Table names and namespaces #311

Sh4dow opened this Issue Mar 8, 2012 · 1 comment

3 participants

Sh4dow commented Mar 8, 2012

I don't know if it is a bug. I wanted to Make two different databases with namespace.e One namespace was "data" and another was "archive" but generator didn't allow me to make such thing. and give me this error

Execution of target "sql-template" failed for the following reason: /home/sh4dow/www/.tools/Propel/generator/build-propel.xml:203:10: Table "additional_group" declared twice

Is there a possibility to generate 2 classes with the same name but different namespace ?


I don't know if you have found a solution but I currently have a similar situation and find a solution.

I am trying to build a propel schema from a PostgreSQL database via reverse task (I am using the sfPropelORMPlugin).
In this database there are two schemas: 'public' and 'old_tables' with same table names.
The reverse task failed with the 'Table "same_table_name" declared twice.

I have found that the problem is in generator/lib/model/Database.php addTable() method, the exception is thrown if the name of the table is set as a key of the tablesByName array. The table name is retrieved via Table::getName(), which must return 'schema.table_name' but in this situation it returns only 'table_name' because Table::getDatabase() returns null as the database is set in Database::addTable() after the test that throws the exception.

So, if I put the $tbl->setDatabase($this) before the test, I no longer have the exception.

I still have to do a pull request with the modification...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.