[TYPO3-dev] class.t3lib_tcemain.php $this->substNEWwithIDs

Franz Holzinger franz at fholzinger.com
Sat Apr 22 19:23:55 CEST 2006


Hello,

does anyone know how the $this->substNEWwithIDs should be used in TYPO3
latest 4.0CVS ?
 * $Id: class.t3lib_tcemain.php,v 1.65.2.31 2006/04/06 13:49:40 mundaun
Exp $


In
function insertDB
you have the lines:


	// Set mapping for NEW... -> real uid:
$NEW_id = $id;		// the NEW_id now holds the 'NEW....' -id
$id = $GLOBALS['TYPO3_DB']->sql_insert_id();
if (!$dontSetNewIdIndex)	{
	$this->substNEWwithIDs[$NEW_id] = $id;
	$this->substNEWwithIDs_table[$NEW_id] = $table;
}



However in the other function it is used in a different manner:


/**
 * Executing dbAnalysisStore
 * This will save MM relations for new records but is executed after
records are created because we need to know the ID of them
 *
 * @return	void
 */
function dbAnalysisStoreExec()	{
	reset($this->dbAnalysisStore);
	while(list($k,$v)=each($this->dbAnalysisStore))	{
		$id = $this->substNEWwithIDs[$v[2]];
		if ($id)	{
			$v[2] = $id;
			$v[0]->writeMM($v[1],$v[2],$v[3]);
		}
	}
}


$this->dbAnalysisStore
is set at
function
checkValue_group_select_processDBdata($valueArray,$tcaFieldConf,$id,$status,$type)
	
if ($tcaFieldConf['MM'])	{
	if ($status=='update')	{
		$dbAnalysis->writeMM($tcaFieldConf['MM'],$id,$prep);
	} else {
		$this->dbAnalysisStore[] =
array($dbAnalysis,$tcaFieldConf['MM'],$id,$prep);	// This will be
traversed later to execute the actions
	}
	$cc=count($dbAnalysis->itemArray);
	$valueArray = array($cc);
} else {



So which is the correct usage of $this->substNEWwithIDs? What shall be
the key - the NEW...id or the id?


I happen to end up in the function dbAnalysisStoreExec() with an error
message because $this->substNEWwithIDs is an empty array in my case.
Where should it have been set and which keys are allowed here?

var $dbAnalysisStore=array();				// For accumulation of MM relations
that must be written after new records are created.
var $substNEWwithIDs = Array();				// When new elements are created,
this array contains a map between their "NEW..." string IDs and the
eventual UID they got when stored in database



- Franz
















More information about the TYPO3-dev mailing list