Changeset 4356
- Timestamp:
- 05/10/08 05:07:36 (8 months ago)
- Files:
-
- 1 modified
-
branches/0.11/lib/Doctrine/Data/Export.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/lib/Doctrine/Data/Export.php
r4094 r4356 47 47 * doExport 48 48 * 49 * FIXME: This function has ugly hacks in it for temporarily disabling INDEXBY query parts of tables 50 * to export. 51 * 52 * Update from jwage: I am not sure if their is any other better solution for this. It may be the correct 53 * solution to disable the indexBy settings for tables when exporting data fixtures. Maybe a better idea 54 * would be to extract this functionality to a pair of functions to enable/disable the index by settings 55 * so simply turn them on and off when they need to query for the translations standalone and don't need 56 * it to be indexed by the lang. 57 * 49 58 * @return void 50 59 */ … … 63 72 $models = Doctrine::initializeModels($models); 64 73 74 // temporarily disable indexBy query parts of selected and related tables 75 $originalIndexBy = array(); 76 foreach ($models AS $name) { 77 $table = Doctrine::getTable($name); 78 if (!is_null($indexBy = $table->getBoundQueryPart('indexBy'))) { 79 $originalIndexBy[$name] = $indexBy; 80 $table->bindQueryPart('indexBy', null); 81 } 82 } 83 65 84 foreach ($models AS $name) { 66 85 if ( ! empty($specifiedModels) AND ! in_array($name, $specifiedModels)) { … … 73 92 $data[$name] = $results; 74 93 } 94 } 95 96 // Restore the temporarily disabled indexBy query parts 97 foreach($originalIndexBy AS $name => $indexBy) { 98 Doctrine::getTable($name)->bindQueryPart('indexBy', $indexBy); 75 99 } 76 100