ReferenceIndexUpdater
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
Attributes
- #[Autoconfigure]
- $public: true
- $shared: false
Table of Contents
Properties
- $dropRegistry : array<int, array<string, array<int, int>>>
- [ workspaceId => [ tableName => [ uid ] ] ]
- $updateRegistry : array<int, array<string, array<int, int>>>
- [ workspaceId => [ tableName => [ uid ] ] ]
- $updateRegistryToItem : array<int, array<string, array<int, array<string, string|int>>>>
- [ workspaceId => [ tableName => [ 'uid' => uid, 'targetWorkspace' => $targetWorkspace ] ] ]
Methods
- __construct() : mixed
- registerForDrop() : void
- 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).
- registerForUpdate() : void
- Register a workspace/table/uid row for update
- registerUpdateForReferencesToItem() : void
- 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.
- update() : void
- Perform the reference index update operations
Properties
$dropRegistry
[ workspaceId => [ tableName => [ uid ] ] ]
protected
array<int, array<string, array<int, int>>>
$dropRegistry
= []
$updateRegistry
[ workspaceId => [ tableName => [ uid ] ] ]
protected
array<int, array<string, array<int, int>>>
$updateRegistry
= []
$updateRegistryToItem
[ workspaceId => [ tableName => [ 'uid' => uid, 'targetWorkspace' => $targetWorkspace ] ] ]
protected
array<int, array<string, array<int, array<string, string|int>>>>
$updateRegistryToItem
= []
Methods
__construct()
public
__construct(TcaSchemaFactory $tcaSchemaFactory, ConnectionPool $connectionPool, ReferenceIndex $referenceIndex) : mixed
Parameters
- $tcaSchemaFactory : TcaSchemaFactory
- $connectionPool : ConnectionPool
- $referenceIndex : ReferenceIndex
registerForDrop()
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).
public
registerForDrop(string $table, int $uid, int $workspace) : void
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
- $table : string
-
Table name, used as tablename and ref_table
- $uid : int
-
Record uid, used as recuid and ref_uid
- $workspace : int
-
Workspace the record lives in
registerForUpdate()
Register a workspace/table/uid row for update
public
registerForUpdate(string $table, int $uid, int $workspace) : void
Parameters
- $table : string
-
Table name
- $uid : int
-
Record uid
- $workspace : int
-
Workspace the record lives in
registerUpdateForReferencesToItem()
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.
public
registerUpdateForReferencesToItem(string $table, int $uid, int $workspace[, int|null $targetWorkspace = null ]) : void
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
- $table : string
-
Table name, used as ref_table
- $uid : int
-
Record uid, used as ref_uid
- $workspace : int
-
The workspace given record lives in
- $targetWorkspace : int|null = null
-
The target workspace the record has been swapped to
update()
Perform the reference index update operations
public
update() : void