Index: branches/5.3.x/core/kernel/utility/temp_handler.php =================================================================== diff -u -N -r15931 -r15932 --- branches/5.3.x/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 15931) +++ branches/5.3.x/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 15932) @@ -1,6 +1,6 @@ _tables; + } + + /** * Create temp table for editing db record from live table. If none ids are given, then just empty tables are created. * * @return void @@ -301,7 +311,7 @@ /** * List of sub-tables * - * @var Array + * @var kTempHandlerSubTable[] * @access protected */ protected $_subTables = Array (); @@ -449,7 +459,6 @@ $this->_raiseEvent('OnAfterCopyToTemp', '', $copied_ids); } - /* @var $sub_table kTempHandlerSubTable */ foreach ($this->_subTables as $sub_table) { if ( !$sub_table->_parentTableKey ) { continue; @@ -535,7 +544,7 @@ $this->_delete(); $this->Application->resetCounters($this->_tableName); - return isset($this->_savedIds['']) ? $this->_savedIds[''] : Array (); + return $this->getSavedIds(); } /** @@ -563,7 +572,6 @@ continue; } - /* @var $sub_table kTempHandlerSubTable */ foreach ($this->_subTables as $sub_table) { $sub_table->subDeleteItems($object, $parsed_prefix['special'], $original_values); } @@ -632,14 +640,13 @@ $this->_saveId($object->Special, $object->GetID()); } - /* @var $sub_table kTempHandlerSubTable */ foreach ($this->_subTables as $sub_table) { $sub_table->subCloneItems($object, $original_values); } } } - return isset($this->_savedIds[$object->Special]) ? $this->_savedIds[$object->Special] : Array (); + return $this->getSavedIds($object->Special); } /** @@ -670,8 +677,6 @@ */ protected function _copyTempToLiveWithSubTables($temp_ids) { - /* @var $sub_table kTempHandlerSubTable */ - $live_ids = Array (); foreach ($temp_ids as $index => $temp_id) { @@ -882,6 +887,30 @@ } /** + * Finds sub-table by prefix. + * + * @param string $prefix Unit config prefix. + * + * @return kTempHandlerSubTable + */ + public function get($prefix) + { + if ( $this->_prefix == $prefix ) { + return $this; + } + + foreach ( $this->_subTables as $sub_table ) { + $found_table = $sub_table->get($prefix); + + if ( $found_table !== null ) { + return $found_table; + } + } + + return null; + } + + /** * Sets parent table * * @param kTempHandlerTable $parent @@ -979,7 +1008,6 @@ } } - /* @var $sub_table kTempHandlerSubTable */ foreach ($this->_subTables as $sub_table) { $sub_table->_drillDown($table, $operation, $same_table, $same_constrain); } @@ -1190,7 +1218,6 @@ { $this->_delete(); - /* @var $sub_table kTempHandlerSubTable */ foreach ($this->_subTables as $sub_table) { $sub_table->deleteAll(); } @@ -1272,6 +1299,18 @@ } /** + * Returns saved ids for given special. + * + * @param string $special Special. + * + * @return array + */ + public function getSavedIds($special = '') + { + return isset($this->_savedIds[$special]) ? $this->_savedIds[$special] : Array (); + } + + /** * Raises event using IDs, that are currently being processed in temp handler * * @param string $name