[DC-1029] Extensions of Doctrine_Template_I18n incompatible with Doctrine_Import Created: 18/Aug/11 Updated: 18/Aug/11 |
|
| Status: | Open |
| Project: | Doctrine 1 |
| Component/s: | Data Fixtures, I18n, Import/Export |
| Affects Version/s: | 1.2.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Trivial |
| Reporter: | Pierrot Evrard | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows 7, XAMPP 1.7.4 with APC and Curl, symfony 1.4.8 |
||
| Attachments: |
|
| Description |
|
Extending Doctrine_Template_I18n class make Doctrine_Import on YAML data with translation fails... Why ? Just because of this line : Doctrine_Import.php, line 135 : In fact, having a template named "Doctrine_Template_I18n" is not strong enough to be sure that the current object has an I18n behavior. The bug is very simple to reproduce : 1. Get a classic I18n fixtures like : Article: 2. Then make a simple extension of the I18n template (do not do anything else but extends the Doctrine_Template_I18n class) : class My_Doctrine_Template_I18n extends Doctrine_Template_I18n {} 3. Load the extension, assign it to your model and try to import your fixtures again. It will not work anymore. Thanks |
| Comments |
| Comment by Pierrot Evrard [ 18/Aug/11 ] |
|
See this patch where to check if the table has the I18n plugin, I check if one of the templates has a getI18n() method. This is probably not strong enough but it can do the job until you find a better solution. Thanks |
| Comment by Pierrot Evrard [ 18/Aug/11 ] |
|
Another possibility to check that templates are I18n template, will be to create an Doctrine_I18n_Interface. Also, every template that include this interface can be considered as I18n templates. What do you think about that ? NB: May the interface can define the method getI18n() to be declared... |