Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Trivial
-
Resolution: Unresolved
-
Affects Version/s: 1.2.4
-
Fix Version/s: None
-
Component/s: Data Fixtures, I18n, Import/Export
-
Labels:None
-
Environment:Windows 7, XAMPP 1.7.4 with APC and Curl, symfony 1.4.8
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 :
if ($table->hasRelation($key) && is_array($value) && ! $table->hasTemplate('Doctrine_Template_I18n')) {
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:
Translation:
en:
title: Lorem Ipsum
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
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...