Details
-
Type:
Improvement
-
Status:
Reopened
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.2.1
-
Fix Version/s: None
-
Component/s: Import/Export
-
Labels:None
-
Environment:Linux, Symfony 1.4.1, Doctrine 1.2.1
Description
When attempting to reverse engineer databases using the generate-yaml-db task (via Symfony's doctrine:build-schema task), I've run into some issues due to table names not being compatible with PHP classnames. It creates the PHP classes in /tmp, setting the class name to the same as the table name, and then attempts to build the YAML files off of those.
I attempted to do this a few months ago and ran into issues because some of the table names began with numbers ("123MyTable" is not a valid PHP class name). My most recent attempt failed because of a table named "List", which is a reserved PHP keyword.
While I'm not sure if this is the ideal solution, I think allowing a way to pre-define a prefix for the generated PHP class names would be great.
I think there seems to be a general problem in usage of table names, when using the generating from database to yml.
I think there something changed with the naming stragegies in the last versions (I do not know in wich one), but it works with doctrine 1.0.10 (used in symfony 1.2.8).
theoretical stragegies:
1. Only the first letter is a capital (e.g. ProjectCategory --> Projectcategory)
2. When a _ is inside the name, the _ is removed an a capital will used (e.g. Project_Values --> ProjectValues)
But doctrine does not make use of this anymore. When I generate with doctrine 1.2.1 (used in symfony 1.3.2) my table ProjectCategory will be named as ProjectCategory in schema. And when the schema is wrong, all generated models are incompatible to older versions.