Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generated Doctrine models respect case, but generated Yaml does not

Just getting started with Doctrine ORM for PHP (v1.1.5) and ran into something unexpected.

I am generating models from the db (MySQL 4) using:

Doctrine::generateModelsFromDb($pathToModels);

Then generating YAML from the models using:

Doctrine::generateYamlFromModels($pathToSchema . '/schema.yml', $pathToModels);

In the generated models, the column names (as defined in hasColumn()) use the same case for the fields as in the db. All good.

But in the generated YAML, the column names are all lower-case, irrespective of the case in the model.

There do not seem to be any options available on the generateYamlFromModels() method that I could conceivably use to tweak this. Is there some other attribute I should be setting someplace, perhaps at connection-level, or at manager-level, etc? Might it be a bug?

Any ideas greatly appreciated. Thanks and cheers!

like image 356
David Weinraub Avatar asked Nov 08 '09 11:11

David Weinraub


1 Answers

It seems this is a bug. I say that because YAML is case sensitive, and Doctrine's generateYAMLFromModels() is documented to be case sensitive. I did find a case sensitivity bug that was in 2.0 beta. Maybe this is the bug that affected your program. Barring anything else, though, it looks like Dimitris Baltas' comment seems to be the the workaround of choice:

an other alternative is to generate models from DB and then yaml from models. This one keeps the right casing.

Happy Hunting :)

like image 191
djhaskin987 Avatar answered Oct 23 '22 03:10

djhaskin987