Let's use this schema as an example
swPage:
tableName: sw_cms_pages
columns:
route: string(255)
title: string(255)
format: string(10)
content: clob
script: clob
css: clob
actAs:
I18n:
tableName: sw_cms_page_translations
fields: [content, title, slug]
generateFiles: true
generatePath: <?php echo sfConfig::get('sf_lib_dir') ?>/model/doctrine/translations
actAs:
Sluggable:
field: [title]
builder: [ swTranslationPage, buildUrl ]
Timestampable:
NestedSet:
hasManyRoots: true
The result of ./symfony doctrine:build-model is 2 files : swPage and swPageTable.
When fetching the first page:
$sw_page = Doctrine_Query::Create()
->select('swPage.*')
->from('swPage')
->leftJoin('swPageTranslation')
->where('swPageTranslation.lang = ? and swPageTranslation.slug = ?', array($culture, $slug))
->fetchOne();
Doctrine generated 2 files : swPageTranslation and BaseswPageTranslation?. The last file is overwritten at every request when the model is loaded. Of course just after, symfony bugs as the sfAutoloader does not known where BaseswPageTranslation? is ... a 'symfony cc' fix this problem.
Anothers problems :
- the generatePath is hardcoded (maybe my example is wrong, but how can I do differently ?)
- the generated files have webserver permission.
So I think the implementation is wrong :
- the symfony task (or doctrine sub task) should create all files (with translation when generateFiles is set to true)
- the webserver should not recreated files at every request !
- the generatedPath should be optional at the symfony layer and not hardcoded into the model (which breaks deployment)