‪TYPO3CMS  10.4
TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater Class Reference

Public Member Functions

if(!in_array($recordAndTargetWorkspace, $this->updateRegistryToItem[$workspace][$table], true)) registerForDrop (string $table, int $uid, int $workspace)
 
 update ()
 

Public Attributes

 $recordAndTargetWorkspace
 

Protected Attributes

array< int, $updateRegistry=array();protected array< int, $updateRegistryToItem=array();protected array< int, $dropRegistry=array();public function registerForUpdate(string $table, int $uid, int $workspace):void { if( $workspace &&!BackendUtility::isTableWorkspaceEnabled( $table)) { $workspace=0;} if(!isset( $this->updateRegistry[ $workspace][ $table])) { $this->updateRegistry[ $workspace][ $table]=[];} if(!in_array( $uid, $this->updateRegistry[ $workspace][ $table], true)) { $this->updateRegistry[ $workspace][ $table][]=$uid;} } public function registerUpdateForReferencesToItem(string $table, int $uid, int $workspace, int $targetWorkspace=null):void { if( $workspace &&!BackendUtility::isTableWorkspaceEnabled( $table)) { $workspace=0;} if( $targetWorkspace===null) { $targetWorkspace=$workspace;} if(!isset( $this->updateRegistryToItem[ $workspace][ $table])) { $this-> updateRegistryToItem [$workspace][$table] = []
 

Detailed Description

Helper class for DataHandler to gather requests for reference index updates and perform them in one go after other operations have been done. This is used to suppress multiple reference index update calls for the same workspace/table/uid combination within one DataHandler main call.

should only be used by the TYPO3 Core

Definition at line 33 of file ReferenceIndexUpdater.php.

Member Function Documentation

◆ registerForDrop()

if (!in_array( $recordAndTargetWorkspace, $this->updateRegistryToItem[ $workspace][ $table], true)) TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater::registerForDrop ( string  $table,
int  $uid,
int  $workspace 
)

Delete rows from sys_refindex a table / uid combination is involved in: Either on left side (tablename + recuid) OR right side (ref_table + ref_uid). Useful in scenarios like workspace-discard where parents or children are hard deleted: The expensive updateRefIndex() does not need to be called since we can just drop straight ahead.

Parameters
string$table‪Table name, used as tablename and ref_table
int$uid‪Record uid, used as recuid and ref_uid
int$workspace‪Workspace the record lives in

Definition at line 123 of file ReferenceIndexUpdater.php.

References TYPO3\CMS\Backend\Utility\BackendUtility\isTableWorkspaceEnabled().

◆ update()

TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater::update ( )

Perform the reference index update operations

Definition at line 142 of file ReferenceIndexUpdater.php.

References TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater\updateRegistryToItem.

Member Data Documentation

◆ $recordAndTargetWorkspace

TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater::$recordAndTargetWorkspace
Initial value:
= [
'uid' => $uid,
'targetWorkspace' => $targetWorkspace
]

Definition at line 104 of file ReferenceIndexUpdater.php.

◆ updateRegistryToItem

array<int, $updateRegistry = array( ); protected array<int, $updateRegistryToItem = array( ); protected array<int, $dropRegistry = array( ); public function registerForUpdate(string $table, int $uid, int $workspace): void { if ($workspace && !BackendUtility::isTableWorkspaceEnabled($table)) { $workspace = 0; } if (!isset($this->updateRegistry[$workspace][$table])) { $this->updateRegistry[$workspace][$table] = []; } if (!in_array($uid, $this->updateRegistry[$workspace][$table], true)) { $this->updateRegistry[$workspace][$table][] = $uid; } } public function registerUpdateForReferencesToItem(string $table, int $uid, int $workspace, int $targetWorkspace = null): void { if ($workspace && !BackendUtility::isTableWorkspaceEnabled($table)) { $workspace = 0; } if ($targetWorkspace === null) { $targetWorkspace = $workspace; } if (!isset($this->updateRegistryToItem[$workspace][$table])) { $this-> TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater::updateRegistryToItem[ $workspace][ $table] = []
protected

[ workspaceId => [ tableName => [ uid ] ] ]

array<string, array<int, int>>>

Definition at line 102 of file ReferenceIndexUpdater.php.

Referenced by TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater\update().