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

Public Member Functions

 __construct (private readonly TcaSchemaFactory $tcaSchemaFactory, private readonly ConnectionPool $connectionPool, private readonly ReferenceIndex $referenceIndex,)
 
 registerForUpdate (string $table, int $uid, int $workspace)
 
 registerUpdateForReferencesToItem (string $table, int $uid, int $workspace, ?int $targetWorkspace=null)
 
 registerForDrop (string $table, int $uid, int $workspace)
 
 update ()
 

Protected Attributes

array $updateRegistry = []
 
array $updateRegistryToItem = []
 
array $dropRegistry = []
 

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 35 of file ReferenceIndexUpdater.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater::__construct ( private readonly TcaSchemaFactory  $tcaSchemaFactory,
private readonly ConnectionPool  $connectionPool,
private readonly ReferenceIndex  $referenceIndex 
)

Definition at line 61 of file ReferenceIndexUpdater.php.

Member Function Documentation

◆ registerForDrop()

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 134 of file ReferenceIndexUpdater.php.

References TYPO3\CMS\Webhooks\Message\$uid.

◆ registerForUpdate()

TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater::registerForUpdate ( string  $table,
int  $uid,
int  $workspace 
)

Register a workspace/table/uid row for update

Parameters
string$table‪Table name
int$uid‪Record uid
int$workspace‪Workspace the record lives in

Definition at line 74 of file ReferenceIndexUpdater.php.

References TYPO3\CMS\Webhooks\Message\$uid.

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

◆ registerUpdateForReferencesToItem()

TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater::registerUpdateForReferencesToItem ( string  $table,
int  $uid,
int  $workspace,
?int  $targetWorkspace = null 
)

Find reference index rows pointing to given table/uid combination and register them for update. Important in delete and publish scenarios where a child is deleted to make sure any references to this child are dropped, too. In publish scenarios reference index may exist for a non-live workspace, but should be updated for live workspace. The optional $targetWorkspace argument is used for this.

Parameters
string$table‪Table name, used as ref_table
int$uid‪Record uid, used as ref_uid
int$workspace‪The workspace given record lives in
int | null$targetWorkspace‪The target workspace the record has been swapped to

Definition at line 101 of file ReferenceIndexUpdater.php.

References TYPO3\CMS\Webhooks\Message\$uid.

◆ update()

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

Member Data Documentation

◆ $dropRegistry

array TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater::$dropRegistry = []
protected

Definition at line 59 of file ReferenceIndexUpdater.php.

◆ $updateRegistry

array TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater::$updateRegistry = []
protected

Definition at line 42 of file ReferenceIndexUpdater.php.

◆ $updateRegistryToItem

array TYPO3\CMS\Core\DataHandling\ReferenceIndexUpdater::$updateRegistryToItem = []
protected

Definition at line 52 of file ReferenceIndexUpdater.php.