Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.1, 1.2.2, 1.2.3, 1.2.4
-
Fix Version/s: None
-
Component/s: Connection, I18n
-
Labels:None
-
Environment:PHP 5.2.11 (with Suhosin-Patch 0.9.7)
PHP 5.3.6
Description
Relating to Translation table (generated by Doctrine_I18n) doesn't work correctly after resetting connection.
First, I defined the following schema.yml::
Example:
actAs:
I18n:
fields: [title]
columns:
title: string(128)
Next, I prepared the following fixture file::
Example:
Example_1:
Translation:
en:
title: "Title"
ja:
title: "題名"
Next, I run "build-all-reload" task. The table was created and data was loaded.
And I write the following code::
Doctrine_Core::loadModels('models');
$example = Doctrine_Core::getTable('Example')->find(1);
var_dump(
$example->Translation['en']->title,
$example->Translation['ja']->title
);
Doctrine_Manager::resetInstance();
Doctrine_Manager::getInstance()->openConnection(DSN, 'doctrine');
$example2 = Doctrine_Core::getTable('Example')->find(1);
var_dump(
$example2->Translation['en']->title,
$example2->Translation['ja']->title
);
I try executing my code, but I got the following error::
string(5) "Title"
string(6) "題名"
Doctrine_Connection_Mysql_Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.title' in 'field list' in /path/to/doctrine/Doctrine/Connection.php on line 1082
Call Stack:
0.0055 65352 1. {main}() /path/to/my/code/test.php:0
0.2776 5873388 2. Doctrine_Table->find() /path/to/my/code/test.php:52
0.2793 5881152 3. Doctrine_Query->fetchOne() /path/to/doctrine/Doctrine/Table.php:1611
0.2793 5881296 4. Doctrine_Query_Abstract->execute() /path/to/doctrine/Doctrine/Query.php:281
0.2793 5881892 5. Doctrine_Query_Abstract->_execute() /path/to/doctrine/Doctrine/Query/Abstract.php:1026
0.3127 5890712 6. Doctrine_Connection->execute() /path/to/doctrine/Doctrine/Query/Abstract.php:976
0.3164 5892632 7. Doctrine_Connection_Statement->execute() /path/to/doctrine/Doctrine/Connection.php:1006
0.3181 5907408 8. Doctrine_Connection->rethrowException() /path/to/doctrine/Doctrine/Connection/Statement.php:269
I've tested Joe Siponen's patch, it would be good in a situation of single connection, but it doesn't work in multiple connections.
So I modified your patch to fit my needs. I'm testing my arranged patch and I want to publish it ASAP...