简体   繁体   中英

I have an incorrect value of parameter id in a Hook of TYPO3 7.6

I want to use a Hook for change values inserted by create record in Backend of TYPO3. For this I need to change value in database, so I should have the id. I am using function processDatamap_postProcessFieldArray ($status, $table, $id, &$fieldArray, &$reference){....} but the $id doesn't have a common value (43, 67, 87, ...) the value is NEW589ce2522e406137033561 and the value after the word NEW changes in each test. I do not understand why it assign this value.

I am using TYPO3 7.6 with PHP 5.6

This happens when you create new record and it is its temporary unique id. If you want to get numeric value you can try to use this code. I use it for example in the processDatamap_afterDatabaseOperations hook

$internalId = $id;

if (strpos($id, 'NEW') !== false) {
    $internalId = $reference->substNEWwithIDs[$id];
}

After that check if $internalId contains id which you want

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM