I’m using Doctrine 1.1.5 and I’d like to know if there is some option for remove table prefix from files and class names when calling Doctrine::generateModelsFromDb or Doctrine::generateModelsFromYaml.
Edit:
For example I have tables like mo_article, mo_language, mo_article_text, etc. When Doctrine generates the models (using the functions from above), the class names will be MoArticle, MoLanguage, MoArticleText, … but I want them to be Article, Language, ArticleText… Is there some option in those functions to avoid adding table prefixes in model class names?
Thank you
I had this exact same scenario and ended up writing my own function to solve it. This function goes through my YAML file, reads each table name, and adds the appropriate
className:entry without the table prefix.Here’s the function:
And here’s how I use it:
One further note – with this method you don’t have the luxury of Doctrine converting your
database_table_nameto the PHP-friendlyClassName, so you have to do this yourself. I used thestrtocamelfunction from here.