View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002700 | OXID eShop (all versions) | 4.06. Language and translations | public | 2011-04-06 10:07 | 2011-04-09 14:38 |
Reporter | Helmut L. | Assigned To | |||
Priority | high | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 4.5.0_beta4 | ||||
Fixed in Version | 4.5.0 revision 34568 | ||||
Summary | 0002700: oxDbMetaDataHandler can not add multiple languages at once to the database | ||||
Description | If you call addNewLangToDb from oxDbMetaDataHandler multiple times only one language is added to the database. The getCurrentMaxLangId method caches the current maximum language and thus at the second call tries to add the fields from the first call again. To correct this the cached maximum language id should be updated at the end of the addNewLangToDb method. | ||||
Steps To Reproduce | Call the addNewLangToDb method multiple times and in the database only the language fields for one language get added. $oDbMeta = oxNew( "oxDbMetaDataHandler" ); $oDbMeta->addNewLangToDb(); $oDbMeta->addNewLangToDb(); | ||||
Additional Information | Enterprise Edition /core/oxdbmetadatahandler.php, line 409 this line should be added: $this->_iCurrentMaxLangId = $this->getNextLangId(); | ||||
Tags | No tags attached. | ||||
Theme | |||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||
related to | 0002699 | resolved | alfonsas_cirtautas | max lang id in database is only retrieved from main table |
related to | 0002471 | resolved | alfonsas_cirtautas | Not possible to create more than 8 languages |
|
If you create a new instances of oxDbMetaDataHandler for every language to add, the mentioned solution does not work. Every instance has its own cache and would correctly try to determine the current max lang id. But the fields are retrieved by oxDb::getInstance()->getTableDescription which has a cache for the table descriptions and thus the old list of fields is used to get the max lang id. The solution would be to either have the same max lang id cache in oxDbMetaDataHandler for every instance or to clear the oxDb cache after changes on the database have been made. |
|
During the creation of the views the field list from oxDb::getInstance()->getTableDescription is also used and thus only the view for the first added language uses the correct fields. The views for the other languages use the fields for the first language, because according to getTableDescription the other fields do not exist. |
|
Fixed by adding cached value reset in oxDbMetaDataHandler::addNewLangToDb() |