From: <rd...@us...> - 2010-09-03 14:37:18
|
Revision: 2023 http://digir.svn.sourceforge.net/digir/?rev=2023&view=rev Author: rdg Date: 2010-09-03 14:37:12 +0000 (Fri, 03 Sep 2010) Log Message: ----------- Fixed bug in the configuration interface (automapping with php5). Modified Paths: -------------- tapirlink/trunk/classes/TpMappingForm.php Modified: tapirlink/trunk/classes/TpMappingForm.php =================================================================== --- tapirlink/trunk/classes/TpMappingForm.php 2010-09-02 20:30:25 UTC (rev 2022) +++ tapirlink/trunk/classes/TpMappingForm.php 2010-09-03 14:37:12 UTC (rev 2023) @@ -39,6 +39,7 @@ var $mLastNs = ''; // Last namespace parsed in the automapping index var $mConceptsWithReferences; // will become array: concept id => array of concept ids var $mBaseConceptId; // base concept id being parsed + var $mLocalMappingCopy; // Copy of the local mapping object to be used during automapping function TpMappingForm( ) { @@ -434,6 +435,17 @@ } // Refresh mappings + + // Create copy of local mapping to avoid messing with iterators + if ( version_compare( phpversion(), '5.0.0', '<' ) > 0 ) + { + $this->mLocalMappingCopy = $this->mResource->GetLocalMapping(); + } + else + { + $this->mLocalMappingCopy = clone $this->mResource->GetLocalMapping(); + } + $r_mapped_schemas =& $r_local_mapping->GetMappedSchemas(); foreach ( $r_mapped_schemas as $ns => $schema ) @@ -535,6 +547,8 @@ } } + $this->mLocalMappingCopy = null; + // Clicked next or save if ( isset( $_REQUEST['next'] ) or isset( $_REQUEST['update'] ) ) { @@ -591,23 +605,23 @@ function GetAutoMapping( $concept ) { - // Note: This method assumes that _LoadIndexOfMappingReferences - // and _LoadReferences on the respective file were already called + // Note: This method assumes that mLocalMappingCopy is set and + // _LoadIndexOfMappingReferences and _LoadReferences were + // already called on the respective file. // Check if there's an equivalent mapping that can be reused $concept_id = $concept->GetId(); - if ( is_array( $this->mConceptsWithReferences ) and + if ( is_object( $this->mLocalMappingCopy ) and + is_array( $this->mConceptsWithReferences ) and isset( $this->mConceptsWithReferences[$concept_id] ) ) { $references = $this->mConceptsWithReferences[$concept_id]; - $local_mapping = $this->mResource->GetLocalMapping(); // work on a copy - foreach ( $references as $reference ) // $reference is a concept id { - $equivalent_concept = $local_mapping->GetConcept( $reference ); + $equivalent_concept = $this->mLocalMappingCopy->GetConcept( $reference ); if ( ( ! is_null( $equivalent_concept ) ) and $equivalent_concept->IsMapped() ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |