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
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