Ticket #706 (closed defect: invalid)
(Attn: Jonwage) generateModelsFromDb issues
| Reported by: | EGreg | Owned by: | JonWage |
|---|---|---|---|
| Priority: | major | Milestone: | 2.0.0 (OLD) |
| Component: | Other | Version: | |
| Severity: | Keywords: | ||
| Cc: | Has Test: | ||
| Status: | Has Patch: |
Description
Okay, disclaimer: I just started learning Doctrine yesterday. I took the DB I already had and called
Doctrine::generateModelsFromDb(my_model_dir($dbName));
Two issues: 1) Request: It did not generate the relations between tables. I have to add these in by hand. I realize this may take some work to add in.
2) Bug: It generated classes which it put in the dir I specified, and it also created a "generated" folder inside, which contains the generated code. That's all good, so I can extend the classes and not have my code overwritten by the generator. But! Then this structure isn't recognized by the autoloader currently. When I called loadModels
Doctrine::loadModels(faf_doctrine_model_dir($dbName), true);
I expected the autoloader to find my classes, such as $user = new User(); It does. But it's funny to see a fatal error saying "BaseUser? not defined." Please make the autoloader work with the structure of the autogenerator. Currently I have to include these things manually.
I think these improvements will really help boost Doctrine's popularity. People come to doctrine FROM some kind of previous setup, and they usually have a database already. It would be nice to autogenerate code from that database without manually retyping the relations, etc. Currently there is a barrier to adoption because of all this menial work that has to be done by the user of Doctrine.