DataHandler

class \TYPO3\CMS\Core\DataHandling\DataHandler

Uses
LogDataTrait

The main data handler class which takes care of correctly updating and inserting records.

This class was formerly known as TCEmain.

This is the TYPO3 Core Engine class for manipulation of the database This class is used by eg. the tce_db BE route (SimpleDataHandlerController) which provides an interface for POST forms to this class.

Dependencies:

  • $GLOBALS['TCA'] must exist
  • $GLOBALS['LANG'] must exist

Also see document 'TYPO3 Core API' for details.

Attributes

#[Autoconfigure]
$public: true
$shared: false

Table of Contents

Constants

CACHE_IDENTIFIER_ELEMENTS_TO_BE_DELETED  : mixed = 'core-datahandler-elementsToBeDeleted'
CACHE_IDENTIFIER_NESTED_ELEMENT_CALLS_PREFIX  : mixed = 'core-datahandler-nestedElementCalls-'
Prefix for the cache entries of nested element calls since the runtimeCache has a global scope.

Properties

$admin  : bool
Will be set if user is admin
$autoVersionIdMap  : array<string, array<int, string>>
Contains mapping of auto-versioned records.
$BE_USER  : BackendUserAuthentication
The user-object the script uses. If not set from outside, this is set to the current global $BE_USER.
$bypassAccessCheckForRecords  : bool
If TRUE, access check, check for deleted etc. for records is bypassed.
$bypassWorkspaceRestrictions  : bool
If TRUE, workspace restrictions are bypassed on edit and create actions (process_datamap()).
$callBackObj  : object|null
Object. Call back object for FlexForm traversal. Useful when external classes wants to use the iteration functions inside DataHandler for traversing a FlexForm structure.
$checkStoredRecords  : mixed
$checkStoredRecords_loose  : mixed
$checkValue_currentRecord  : array
Set to "currentRecord" during checking of values.
$cmdmap  : array<string, array<int|string, array>>
Incoming command array. The array shape is checked in start() before setting this property.
$copyMappingArray  : array<string, array>
Used by the copy action to track the ids of new pages so subpages are correctly inserted! THIS is internally cleared for each executed copy operation! DO NOT USE THIS FROM OUTSIDE! Read from copyMappingArray_merged instead which is accumulating this information.
$copyMappingArray_merged  : array
This array is the sum of all copying operations in this class.
$copyTree  : int
If 0 then branch is NOT copied.
$copyWhichTables  : string
Comma-separated list. This list of tables decides which tables will be copied. If empty then none will.
$datamap  : array<string, array<int|string, array>>
Set with incoming data array. The array shape is checked in start() before setting this property.
$dbAnalysisStore  : array
For accumulation of MM relations that must be written after new records are created.
$defaultValues  : array
[table][fields]=value: New records are created with default values and you can set this array on the form $defaultValues[$table][$field] = $value to override the default values fetched from TCA.
$dontProcessTransformations  : bool
If set, then transformations are NOT performed on the input.
$enableLogging  : bool
If TRUE, actions are logged to sys_log.
$errorLog  : array
Errors are collected in this variable.
$isImporting  : bool
If set, then the TCE class has been instantiated during an import action of a T3D
$neverHideAtCopy  : bool
If set, then the 'hideAtCopy' flag for tables will be ignored.
$newRelatedIDs  : array
Holds the tables and there the ids of newly created child records from IRRE
$pagetreeNeedsRefresh  : bool
Indicates whether the pagetree needs a refresh because of important changes
$pagetreeRefreshFieldsFromPages  : array
Fields from the pages-table for which changes will trigger a pagetree refresh
$registerDBList  : array<string, array<int, array>>
Used for tracking references that might need correction after operations
$registerDBPids  : array
Used for tracking references that might need correction in pid field after operations (e.g. IRRE)
$remapStack  : array
Array used for remapping uids and values at the end of process_datamap
$remapStackRecords  : array
Array used for remapping uids and values at the end of process_datamap (e.g. $remapStackRecords[<table>][<uid>] = <index in $remapStack>)
$reverseOrder  : bool
If TRUE, the datamap array is reversed in the order, which is a nice thing if you're creating a whole new bunch of records.
$sortIntervals  : int
The interval between sorting numbers used with tables with a 'sorting' field defined.
$storeLogMessages  : bool
If TRUE, the default log-messages will be stored. This should not be necessary if the locallang-file for the log-display is properly configured. So disabling this will just save some database-space as the default messages are not saved.
$substNEWwithIDs  : array
When new elements are created, this array contains a map between their "NEW..." string IDs and the final uid they got when stored in database. This public array is rather important since it is used by many DH consumers to further work with records after creation.
$substNEWwithIDs_table  : array
Like $substNEWwithIDs, but where each old "NEW..." id is mapped to the table it was from.
$suggestedInsertUids  : array
Use this array to validate suggested uids for tables by setting [table]:[uid]. This is a dangerous option since it will force the inserted record to have a certain UID. The value just have to be TRUE, but if you set it to "DELETE" it will make sure any record with that UID will be deleted first (raw delete).
$userid  : int
Will be set to uid of be_user executing this script
$control  : array
Data submitted from the form view, used to control behaviours, e.g. this is used to activate/deactivate fields and thus store NULL values
$correlationId  : CorrelationId|null
A string which can be used as correlationId for RecordHistory entries.
$excludedTablesAndFields  : array
The list of <table>-<fields> that cannot be edited by user. This is compiled from TCA/exclude-flag combined with non_exclude_fields for the user.
$historyRecords  : array
List of changed old record ids to new records ids
$mmHistoryRecords  : array
List of changed old record ids to new records ids
$outerMostInstance  : self|null
The outermost instance of \TYPO3\CMS\Core\DataHandling\DataHandler: This object instantiates itself on versioning and localization .
$recordPidsForDeletedRecords  : array
Internal cache for pids of records which were deleted. It's not possible to retrieve the parent folder/page at a later stage
$recordsToClearCacheFor  : array
Internal cache for collecting records that should trigger cache clearing
$referenceIndexUpdater  : ReferenceIndexUpdater
Registry object to gather reference index update requests and perform updates after main processing has been done. It is created upon first start() call and hand over when dealing with internal sub instances. The final update() call is done at the end of process_cmdmap() or process_datamap() in the outermost instance.
$remapStackActions  : array
Array used for executing addition actions after remapping happened (set processRemapStack())
$useTransOrigPointerField  : bool
Will distinguish between translations (with parent) and localizations (without parent) while still using the same methods to copy the records TRUE: translation of a record connected to the default language FALSE: localization of a record without connection to the default language

Methods

__construct()  : mixed
addRemapAction()  : void
Adds an instruction to the remap action stack (used with IRRE).
checkRecordInsertAccess()  : bool
Unused. Removed in TYPO3 v14.
checkRecordUpdateAccess()  : bool
Unused. Removed in TYPO3 v14.
checkValue()  : array
Evaluates a value according to $table/$field settings.
checkValue_category_processDBdata()  : array
Returns processed data for category fields
checkValue_checkMax()  : array
Checks if a fields has more items than defined via TCA in maxitems.
checkValue_flex_procInData()  : array|null
Starts the processing the input data for flexforms. This will traverse all sheets / languages and for each it will traverse the sub-structure.
checkValue_flex_procInData_travDS()  : void
Processing of the sheet/language data array When it finds a field with a value the processing is done by ->checkValue_SW() by default but if a call back function name is given that method in this class will be called for the processing instead.
checkValue_group_select_explodeSelectGroupValue()  : array
Explodes the $value, which is a list of files/uids (group select)
checkValue_group_select_processDBdata()  : array
Returns data for group/db and select fields
checkValue_inline()  : mixed
Evaluates 'inline' type values.
checkValue_input_Eval()  : array
Evaluation of 'input'-type values based on 'eval' list
checkValue_SW()  : array
Branches out evaluation of a field value based on its type as configured in $GLOBALS['TCA'] Can be called for FlexForm pseudo fields as well, BUT must not have $field set if so.
checkValue_text_Eval()  : array
checkValueForFile()  : array
Evaluates 'file' type values.
checkValueForInline()  : array|false
Evaluates 'inline' type values.
clear_cacheCmd()  : void
Clears the cache based on the command $cacheCmd.
clearPrefixFromValue()  : string
Removes the prependAtCopy prefix on values
compareFieldArrayWithCurrentAndUnset()  : array
Compares the incoming field array with the current record and unsets all fields which are the same.
copyPages()  : void
Copying pages Main function for copying pages.
copyRecord()  : int|null
Copying a single record
copyRecord_flexFormCallBack()  : array
Callback function for traversing the FlexForm structure in relation to creating copied files of file relations inside of flex form structures.
copyRecord_procBasedOnFieldType()  : array|string|null
Processing/Preparing content for copyRecord() function
copyRecord_raw()  : int|null
Copying records, but makes a "raw" copy of a record.
copySpecificPage()  : int|null
Copying a single page ($uid) to $destPid and all tables in the array copyTablesArray.
dbAnalysisStoreExec()  : void
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
deleteAction()  : void
Delete a single record.
deleteClause()  : string
Unused. Removed in TYPO3 v14.
deleteEl()  : void
Delete element from any table
deleteL10nOverlayRecords()  : void
Find l10n-overlay records and perform the requested delete action for these records.
deleteRecord()  : void
Deleting a record This function may not be used to delete pages-records unless the underlying records are already deleted Deletes a record regardless of versioning state (live or offline, doesn't matter, the uid decides) If both $noRecordCheck and $forceHardDelete are set it could even delete a "deleted"-flagged record!
destNotInsideSelf()  : bool
Checks if page $id is a uid in the rootline of page id $destinationId Used when moving a page
disableDeleteClause()  : void
Unused. Removed in TYPO3 v14.
doesPageHaveUnallowedTables()  : array
Checks if there are records on a page from tables that are not allowed
fillInFieldArray()  : array
Filling in the field array $this->excludedTablesAndFields is used to filter fields if needed.
fixUniqueInPid()  : void
Checks if any uniqueInPid eval input fields are in the record and if so, they are re-written to be correct.
getAutoVersionId()  : int|null
Gets the automatically versionized id of a record.
getCopyHeader()  : string
Get modified header for a copied record
getCorrelationId()  : CorrelationId|null
getExcludeListArray()  : array
Generate an array of fields to be excluded from editing for the user. Based on "exclude"-field in TCA and a look up in non_exclude_fields Will also generate this list for admin-users so they must be check for before calling the function
getHistoryRecords()  : array
getPID()  : mixed
Unused. Removed in TYPO3 v14.
getRecordProperties()  : array|null
Unused. Removed in TYPO3 v14.
getRecordPropertiesFromRow()  : array|null
Unused. Removed in TYPO3 v14.
getRecordsWithSameValue()  : array
gets all records that have the same value in a field excluding the given uid
getRelationFieldType()  : string|bool
Returns the subtype as a string of a relation (inline / file) field.
getTableEntries()  : array
Extract entries from TSconfig for a specific table. This will merge specific and default configuration together.
getUnique()  : string
Gets a unique value for $table/$id/$field based on $value
getVersionizedIncomingFieldArray()  : void
If a parent record was versionized on a workspace in $this->process_datamap, it might be possible, that child records (e.g. on using IRRE) were affected.
hasPageContextPermission()  : bool
Checks whether the current backend user holds the requested permissions for a record of $table in the context of the given page.
hasPagePermission()  : bool
hasPermissionToUpdate()  : bool
Checks if user may update a record $table on given page record
hook_processDatamap_afterDatabaseOperations()  : void
Hook: processDatamap_afterDatabaseOperations (calls $hookObj->processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, $this);)
insertDB()  : int|null
Insert into database Does not check permissions but expects them to be verified on beforehand
insertNewCopyVersion()  : int|null
Inserts a record in the database, passing TCA configuration values through checkValue() but otherwise does NOTHING and checks nothing regarding permissions.
insertUpdateDB_preprocessBasedOnFieldType()  : array
Preprocesses field array based on field type. Some fields must be adjusted before going to database. This is done on the copy of the field array because original values are used in remap action later.
int_pageTreeInfo()  : array
Returns array, $CPtable, of pages under the $pid going down to $counter levels.
isInWebMount()  : bool
Unused. Removed in TYPO3 v14.
isOuterMostInstance()  : bool
Determines whether this object is the outermost instance of itself Since DataHandler can create nested objects of itself, this method helps to determine the first (= outermost) one.
isRecordCopied()  : bool
Determine if a record was copied or if a record is the result of a copy action.
isRecordInWebMount()  : bool
Unused. Removed in TYPO3 v14.
isReferenceField()  : bool
Returns TRUE if the TCA/columns field type is a DB reference field
localize()  : int|bool
Localizes a record to another system language
log()  : int
Logging actions from DataHandler
moveL10nOverlayRecords()  : void
Find l10n-overlay records and perform the requested move action for these records.
moveRecord()  : void
Move a single record.
moveRecord_procBasedOnFieldType()  : void
Unused. Removed in TYPO3 v14.
moveRecord_procFields()  : void
Unused. Removed in TYPO3 v14.
moveRecord_raw()  : void
Unused. Removed in TYPO3 v14.
newFieldArray()  : array
Returns a fieldArray with default values. Values will be picked up from the TCA array looking at the config key "default" for each column. If values are set in ->defaultValues they will overrule though. Used for new records and during copy operations for defaults.
printLogErrorMessages()  : non-empty-string[]
Print log error messages from the operations of this script instance and return a list of the erroneous records
process_cmdmap()  : void|bool
Processing the cmd-array See "TYPO3 Core API" for a description of the options.
process_datamap()  : void
Processing the data-array Call this function to process the data-array set by start()
processRemapStack()  : void
Processes the $this->remapStack at the end of copying, inserting, etc. actions.
recordInfo()  : array|null
Unused. Removed in TYPO3 v14.
recordInfoWithPermissionCheck()  : array<string, mixed>|false
Unused. Removed in TYPO3 v14.
registerRecordIdForPageCacheClearing()  : void
Clearing the cache based on a page being updated If the $table is 'pages' then cache is cleared for all pages on the same level (and subsequent?) Else just clear the cache for the parent page of the record.
registerReferenceIndexRowsForDrop()  : 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).
registerReferenceIndexUpdateForReferencesToItem()  : void
Helper method to access referenceIndexUpdater->registerUpdateForReferencesToItem() from within workspace DataHandlerHook.
remapListedDBRecords()  : void
Processes the fields with references as registered during the copy process. This includes all FlexForm fields which had references.
remapListedDBRecords_flexFormCallBack()  : array
Callback function for traversing the FlexForm structure in relation to creating copied files of file relations inside of flex form structures.
remapListedDBRecords_procDBRefs()  : array|null
Performs remapping of old UID values to NEW uid values for a DB reference field.
remapListedDBRecords_procFile()  : void
Performs remapping of old UID values to NEW uid values for an file field.
remapListedDBRecords_procInline()  : void
Performs remapping of old UID values to NEW uid values for an inline field.
resolvePid()  : int
Get the final pid based on $table and $pid ($destPid type... pos/neg)
setControl()  : void
setCorrelationId()  : void
setDefaultsFromUserTS()  : void
Initializes default values coming from user TSconfig
setHistory()  : void
Setting sys_history record, based on content previously set in $this->historyRecords[$table . ':' . $id] (by compareFieldArrayWithCurrentAndUnset())
setMirror()  : void
Function that can mirror input values in datamap-array to other uid numbers.
start()  : void
Initializing.
updateDB()  : void
Update database record Does not check permissions but expects them to be verified on beforehand
updateRefIndex()  : void
Register a table/uid combination in current user workspace for reference updating.
versionizeRecord()  : int|null
Creates a new version of a record if the table is workspace aware.
versionPublishManyToManyRelations()  : void
Handle MM relations attached to a record when publishing a workspace record.
workspaceCannotEditOfflineVersion()  : string
Evaluates if a user is allowed to edit the offline version
workspaceCannotEditRecord()  : string|false
Checking if editing of an existing record is allowed in current workspace if that is offline.
addDefaultPermittedLanguageIfNotSet()  : array
If a "languageField" is specified for $table this function will add a possible value to the incoming array if none is found in there already.
applyDefaultsForFieldArray()  : array
When a new record is created, all values that haven't been set but are set via PageTSconfig / UserTSconfig get applied here.
applyFiltersToValues()  : array|mixed
Applies the filter methods from a column's TCA configuration to a value array.
canDeletePage()  : string|null
Evaluate if a page can be deleted. Checks access to page and sub pages, and access to records on them.
castReferenceValue()  : int|string
Casts a reference value. In case MM relations or foreign_field references are used. All other configurations, as well as foreign_table(!) could be stored as comma-separated-values as well. Since the system is not able to determine the default value automatically then, the TCA default value is used if it has been defined.
checkModifyAccessList()  : bool
Check user/group for modify table permission of a given table.
checkValue_file_processDBdata()  : mixed
Returns data for file fields.
checkValue_inline_processDBdata()  : string
Returns data for inline fields.
checkValueForCategory()  : array
Evaluate 'category' type values
checkValueForCheck()  : array
Evaluates 'check' type values.
checkValueForColor()  : array
Evaluate "color" type values.
checkValueForDatetime()  : array
Evaluate 'datetime' type values
checkValueForEmail()  : array
Evaluate "email" type values.
checkValueForFlex()  : array
Evaluates 'flex' type values.
checkValueForGroupFolderSelect()  : array
Evaluates 'group', 'folder' or 'select' type values.
checkValueForInput()  : array
Evaluate "input" type values.
checkValueForInternalReferences()  : array
Checks values that are used for internal references. If the provided $value is a NEW-identifier, the direct processing is stopped. Instead, the value is forwarded to the remap-stack to be post-processed and resolved into a proper UID after all data has been resolved.
checkValueForJson()  : array
Evaluate "json" type values.
checkValueForLanguage()  : array
Evaluate "language" type value.
checkValueForLink()  : array
Evaluate "link" type values.
checkValueForNumber()  : array
Evaluate 'number' type values
checkValueForPassword()  : array
Evaluate "password" type values.
checkValueForRadio()  : array
Evaluates 'radio' type values.
checkValueForSlug()  : array
Evaluate "slug" type values.
checkValueForText()  : array
Evaluate "text" type values.
checkValueForUuid()  : array
Evaluate "uuid" type values. Will create a new uuid in case an invalid uuid is provided and the field is marked as required.
controlActiveElements()  : void
Controls active elements and sets NULL values if not active.
copy_remapTranslationSourceField()  : void
Remap languageSource field to uids of newly created records
copyL10nOverlayRecords()  : void
Find l10n-overlay records and perform the requested copy action for these records.
copyRecord_processManyToMany()  : string
Processes the children of an MM relation field (select, group, inline) when the parent record is copied.
copyRecord_processRelation()  : string
Processes relations in an inline (IRRE) or file element when the parent record is copied.
createRelationHandlerInstance()  : RelationHandler
deleteRecord_procFields()  : void
Before a record is deleted, check if it has references such as inline type or MM references.
deleteSpecificPage()  : void
Delete a page (or set deleted field to 1) and all records on it.
discard()  : void
Discard a versioned record from this workspace. This deletes records from the database - no soft delete.
discardCsvReferencesToRecord()  : void
When the to-discard record is the target of a CSV group field of another table record, these records need to be updated to no longer point to the discarded record.
discardLocalizationOverlayRecords()  : void
Find localization overlays of a record and discard them.
discardLocalizedWorkspaceVersionsOfRecord()  : void
When deleting a live element with sys_language_uid = 0, there may be translated records that have been created in workspaces only (t3ver_state=1). Those have to be discarded explicitly since the other 'delete' related code does not consider this case, otherwise the 'new' workspace translation would be dangling when the live record is gone.
discardMmRelations()  : void
When a workspace record row is discarded that has mm relations, existing mm table rows need to be deleted. The method performs the delete operation depending on TCA field configuration.
discardRecordRelations()  : void
Discard record relations like inline and MM of a record.
discardSubPagesAndRecordsOnPage()  : void
Also discard any sub pages and records of a new parent page if this page is discarded.
discardWorkspaceVersionsOfRecord()  : void
Discard workspace overlays of a live record: When a live row is deleted, all existing workspace overlays are discarded.
doesRecordExist_pageLookUp()  : array|false
Unused. Removed in TYPO3 v14.
fixCopyAfterDuplFields()  : array
When a record is copied you can specify fields from the previous record which should be copied into the new one
fixUniqueInSite()  : bool
Checks if any uniqueInSite eval fields are in the record and if so, they are re-written to be correct.
fixUniqueInSiteForSubpages()  : void
Check if there are subpages that need an adoption as well
formatLogDetails()  : string
Replaces a string with placeholders (%s or {myPlaceholder}) with its substitutes.
formatLogDetailsStatic()  : string
Static version for ViewHelpers etc.
getAllowedTablesToCopyWhenCopyingAPage()  : array
Compile a list of tables that should be copied along when a page is about to be copied.
getCommandMapElements()  : array
Gets elements of the command map that match a particular command.
getDefaultLanguagePageId()  : int
Find out if the record is a localization. If so, get the uid of the default language page.
getLanguageService()  : LanguageService
getLocalTCE()  : DataHandler
Returns an instance of DataHandler for handling local datamaps/cmdmaps
getOriginalParentOfRecord()  : int[]
Gets UID of parent record. If record is deleted it will be looked up in an array built before the record was deleted
getOuterMostInstance()  : DataHandler
Gets the outer most instance of \TYPO3\CMS\Core\DataHandling\DataHandler Since \TYPO3\CMS\Core\DataHandling\DataHandler can create nested objects of itself, this method helps to determine the first (= outer most) one.
getPreviousLocalizedRecordUid()  : int
Returning uid of "previous" localized record, if any, for tables with a "sortby" column.
getRecordHistoryStore()  : RecordHistoryStore
getSiteLanguageForPage()  : SiteLanguage|null
Find a site language by the given language ID for a specific page, and check for all available sites if the page ID is "0".
getSortNumber()  : int|array|false
Returning sorting number for tables with a "sortby" column Using when new records are created and existing records are moved around.
getSubPagesOfPage()  : array<string, mixed>[]
Checks if a whole branch of pages exists.
getUniqueCountStatement()  : QueryBuilder
Gets the count of records for a unique field
hardDeleteSingleRecord()  : void
Simple helper method to hard delete one row from table ignoring delete TCA field
hasPermissionToInsert()  : bool
Checks if user may insert a record from $table on $pid
increaseSortingOfFollowingRecords()  : void
Increases sorting field value of all records with sorting higher than $sortingValue
initializeSlugFieldsToEmptyString()  : array
New records capable of handling slugs (TCA type 'slug'), always require the field value to be set, in order to run through the validation process to create a new slug. Fields having `null` as value are ignored and can be used to by-pass implicit slug initialization.
initializeUuidFieldsToEmptyString()  : array
New records having uuid (TCA type 'uuid') fields defined as required need to be set, in order to run through the validation process to create a new uuid.
inlineLocalizeSynchronize()  : void
Performs localization or synchronization of child records.
isElementToBeDeleted()  : bool
Determines whether an element was registered to be deleted in the registry.
isNestedElementCallRegistered()  : bool
Determines nested element calls.
isRecordLocalized()  : bool
Returns true if a localization of a record exists.
isSubmittedValueEqualToStoredValue()  : bool
Determines whether submitted values and stored values are equal.
isTableAllowedForThisPage()  : bool
Checks if a table is allowed on a certain page id according to allowed tables set for the page "doktype" and its [ctrl][rootLevel]-settings if any.
isTableAllowedForThisPageObsolete()  : bool
Unused. Removed in TYPO3 v14.
overlayAutoVersionId()  : int
Overlays the automatically versionized id of a record.
pageInfo()  : int|string|null
Unused. Removed in TYPO3 v14.
postProcessDatabaseInsert()  : int
Entry point to post process a database insert. Currently bails early unless a UID has been forced and the database platform is not MySQL.
postProcessPostgresqlInsert()  : void
PostgreSQL works with sequences for auto increment columns. A sequence is not updated when a value is written to such a column. To avoid clashes when the sequence returns an existing ID this helper will update the sequence to the current max value of the column.
prepareCacheFlush()  : array
Prepare the cache clearing
prependLabel()  : string
Return "copy" label for a table. Although the name is "prepend" it actually APPENDs the label (after ...)
processClearCacheQueue()  : void
Do the actual clear cache
registerElementsToBeDeleted()  : void
Registers elements to be deleted in the registry.
registerNestedElementCall()  : void
Registers nested elements calls.
resetElementsToBeDeleted()  : void
Resets the elements to be deleted in the registry.
resetNestedElementCalls()  : void
Resets the nested element calls.
resolveFieldConfigurationAndRespectColumnsOverrides()  : array
Use columns overrides for evaluation.
resolveSortingAndPidForNewRecord()  : array
Sets the "sorting" DB field and the "pid" field of an incoming record that should be added (NEW1234) depending on the record that should be added or where it should be added.
resolveVersionedRecords()  : array
Resolves versioned records for the current workspace scope.
setNullValues()  : void
Sets NULL values in haystack array.
softOrHardDeleteSingleRecord()  : void
Straight db based record deletion: Either set deleted = 1 for soft-delete enabled tables, or remove row from table.
undeleteRecord()  : void
Restore live records by setting soft-delete flag to 0.
undeleteRecordRelations()  : void
Check if a to-restore record has inline references and restore them.
unserializeLogData()  : array|null
Useful for handling old serialized data, which might have been migrated to JSON encoded properties already.
unsetElementsToBeDeleted()  : array
Unsets elements (e.g. of the data map) that shall be deleted.
updateFlexFormData()  : void
Updates FlexForm data.
validateValueForRequired()  : bool
Checks if required=true is set: if set: checks if the value is not empty (or not "0").
workspaceAllowAutoCreation()  : bool
Evaluates if auto creation of a version of a record is allowed.

Constants

CACHE_IDENTIFIER_ELEMENTS_TO_BE_DELETED

protected mixed CACHE_IDENTIFIER_ELEMENTS_TO_BE_DELETED = 'core-datahandler-elementsToBeDeleted'

CACHE_IDENTIFIER_NESTED_ELEMENT_CALLS_PREFIX

Prefix for the cache entries of nested element calls since the runtimeCache has a global scope.

protected mixed CACHE_IDENTIFIER_NESTED_ELEMENT_CALLS_PREFIX = 'core-datahandler-nestedElementCalls-'

Properties

$admin

Will be set if user is admin

public bool $admin

$autoVersionIdMap

Contains mapping of auto-versioned records.

public array<string, array<int, string>> $autoVersionIdMap = []

$bypassAccessCheckForRecords

If TRUE, access check, check for deleted etc. for records is bypassed.

public bool $bypassAccessCheckForRecords = false

YOU MUST KNOW what you are doing if you use this feature!

$bypassWorkspaceRestrictions

If TRUE, workspace restrictions are bypassed on edit and create actions (process_datamap()).

public bool $bypassWorkspaceRestrictions = false

YOU MUST KNOW what you do if you use this feature!

$callBackObj

Object. Call back object for FlexForm traversal. Useful when external classes wants to use the iteration functions inside DataHandler for traversing a FlexForm structure.

public object|null $callBackObj = null

$checkStoredRecords

Deprecated

Unused. Will be removed with TYPO3 v14.

public mixed $checkStoredRecords = true

$checkStoredRecords_loose

Deprecated

Unused. Will be removed with TYPO3 v14.

public mixed $checkStoredRecords_loose = true

$checkValue_currentRecord

Set to "currentRecord" during checking of values.

public array $checkValue_currentRecord = []

$cmdmap

Incoming command array. The array shape is checked in start() before setting this property.

public array<string, array<int|string, array>> $cmdmap = []

Tags

todo:

This is public to allow manipulation by hooks (e.g. workspaces). Consider introduction of a public setter setCommandMap() that checks the array shape as done in start() already. Then have a getter as well and protect this property.

$copyMappingArray

Used by the copy action to track the ids of new pages so subpages are correctly inserted! THIS is internally cleared for each executed copy operation! DO NOT USE THIS FROM OUTSIDE! Read from copyMappingArray_merged instead which is accumulating this information.

public array<string, array> $copyMappingArray = []

NOTE: This is used by some outside scripts (e.g. hooks), as the results in $copyMappingArray_merged are only available after an action has been completed.

$copyMappingArray_merged

This array is the sum of all copying operations in this class.

public array $copyMappingArray_merged = []

$copyTree

If 0 then branch is NOT copied.

public int $copyTree = 0

If 1 then pages on the 1st level is copied. If 2 then pages on the second level is copied ... and so on

$copyWhichTables

Comma-separated list. This list of tables decides which tables will be copied. If empty then none will.

public string $copyWhichTables = '*'

If '*' then all will (that the user has permission to of course)

$datamap

Set with incoming data array. The array shape is checked in start() before setting this property.

public array<string, array<int|string, array>> $datamap = []

Tags

todo:

This is public to allow manipulation by hooks (e.g. workspaces). Consider introduction of a public setter setCommandMap() that checks the array shape as done in start() already. Then have a getter as well and protect this property.

$dbAnalysisStore

For accumulation of MM relations that must be written after new records are created.

public array $dbAnalysisStore = []

$defaultValues

[table][fields]=value: New records are created with default values and you can set this array on the form $defaultValues[$table][$field] = $value to override the default values fetched from TCA.

public array $defaultValues = []

If ->setDefaultsFromUserTS is called UserTSconfig default values will overrule existing values in this array (thus UserTSconfig overrules externally set defaults which overrules TCA defaults)

$dontProcessTransformations

If set, then transformations are NOT performed on the input.

public bool $dontProcessTransformations = false

$enableLogging

If TRUE, actions are logged to sys_log.

public bool $enableLogging = true

$errorLog

Errors are collected in this variable.

public array $errorLog = []

$isImporting

If set, then the TCE class has been instantiated during an import action of a T3D

public bool $isImporting = false

$neverHideAtCopy

If set, then the 'hideAtCopy' flag for tables will be ignored.

public bool $neverHideAtCopy = false

$newRelatedIDs

Holds the tables and there the ids of newly created child records from IRRE

public array $newRelatedIDs = []

$pagetreeNeedsRefresh

Indicates whether the pagetree needs a refresh because of important changes

public bool $pagetreeNeedsRefresh = false

$pagetreeRefreshFieldsFromPages

Fields from the pages-table for which changes will trigger a pagetree refresh

public array $pagetreeRefreshFieldsFromPages = ['pid', 'sorting', 'deleted', 'hidden', 'title', 'doktype', …
Show the full value['pid', 'sorting', 'deleted', 'hidden', 'title', 'doktype', 'is_siteroot', 'fe_group', 'nav_hide', 'nav_title', 'module', 'starttime', 'endtime', 'content_from_pid', 'extendToSubpages']

$registerDBList

Used for tracking references that might need correction after operations

public array<string, array<int, array>> $registerDBList = []

$registerDBPids

Used for tracking references that might need correction in pid field after operations (e.g. IRRE)

public array $registerDBPids = []

$remapStack

Array used for remapping uids and values at the end of process_datamap

public array $remapStack = []

$remapStackRecords

Array used for remapping uids and values at the end of process_datamap (e.g. $remapStackRecords[<table>][<uid>] = <index in $remapStack>)

public array $remapStackRecords = []

$reverseOrder

If TRUE, the datamap array is reversed in the order, which is a nice thing if you're creating a whole new bunch of records.

public bool $reverseOrder = false

$sortIntervals

The interval between sorting numbers used with tables with a 'sorting' field defined.

public int $sortIntervals = 256

Min 1, should be power of 2

$storeLogMessages

If TRUE, the default log-messages will be stored. This should not be necessary if the locallang-file for the log-display is properly configured. So disabling this will just save some database-space as the default messages are not saved.

public bool $storeLogMessages = true

$substNEWwithIDs

When new elements are created, this array contains a map between their "NEW..." string IDs and the final uid they got when stored in database. This public array is rather important since it is used by many DH consumers to further work with records after creation.

public array $substNEWwithIDs = []

$substNEWwithIDs_table

Like $substNEWwithIDs, but where each old "NEW..." id is mapped to the table it was from.

public array $substNEWwithIDs_table = []

$suggestedInsertUids

Use this array to validate suggested uids for tables by setting [table]:[uid]. This is a dangerous option since it will force the inserted record to have a certain UID. The value just have to be TRUE, but if you set it to "DELETE" it will make sure any record with that UID will be deleted first (raw delete).

public array $suggestedInsertUids = []

The option is used for import of T3D files when synchronizing between two mirrored servers. As a security measure this feature is available only for Admin Users (for now)

$userid

Will be set to uid of be_user executing this script

public int $userid

$control

Data submitted from the form view, used to control behaviours, e.g. this is used to activate/deactivate fields and thus store NULL values

protected array $control = []

$correlationId

A string which can be used as correlationId for RecordHistory entries.

protected CorrelationId|null $correlationId = null

The string can later be used to rollback multiple changes at once.

$excludedTablesAndFields

The list of <table>-<fields> that cannot be edited by user. This is compiled from TCA/exclude-flag combined with non_exclude_fields for the user.

protected array $excludedTablesAndFields = []

$historyRecords

List of changed old record ids to new records ids

protected array $historyRecords = []

$mmHistoryRecords

List of changed old record ids to new records ids

protected array $mmHistoryRecords = []

$outerMostInstance

The outermost instance of \TYPO3\CMS\Core\DataHandling\DataHandler: This object instantiates itself on versioning and localization .

protected self|null $outerMostInstance = null

..

$recordPidsForDeletedRecords

Internal cache for pids of records which were deleted. It's not possible to retrieve the parent folder/page at a later stage

protected static array $recordPidsForDeletedRecords = []

$recordsToClearCacheFor

Internal cache for collecting records that should trigger cache clearing

protected static array $recordsToClearCacheFor = []

$referenceIndexUpdater

Registry object to gather reference index update requests and perform updates after main processing has been done. It is created upon first start() call and hand over when dealing with internal sub instances. The final update() call is done at the end of process_cmdmap() or process_datamap() in the outermost instance.

protected ReferenceIndexUpdater $referenceIndexUpdater

$remapStackActions

Array used for executing addition actions after remapping happened (set processRemapStack())

protected array $remapStackActions = []

$useTransOrigPointerField

Will distinguish between translations (with parent) and localizations (without parent) while still using the same methods to copy the records TRUE: translation of a record connected to the default language FALSE: localization of a record without connection to the default language

protected bool $useTransOrigPointerField = true

Methods

__construct()

public __construct(EventDispatcherInterface $eventDispatcher, CacheManager $cacheManager, FrontendInterface $runtimeCache, ConnectionPool $connectionPool, LoggerInterface $logger, PagePermissionAssembler $pagePermissionAssembler, TcaSchemaFactory $tcaSchemaFactory, PageDoktypeRegistry $pageDoktypeRegistry, FlexFormTools $flexFormTools, PasswordHashFactory $passwordHashFactory, Random $randomGenerator, TypoLinkCodecService $typoLinkCodecService, OpcodeCacheService $opcodeCacheService, FlashMessageService $flashMessageService, SiteFinder $siteFinder) : mixed

Parameters

$eventDispatcher : EventDispatcherInterface
$cacheManager : CacheManager
$runtimeCache : FrontendInterface
$connectionPool : ConnectionPool
$logger : LoggerInterface
$pagePermissionAssembler : PagePermissionAssembler
$tcaSchemaFactory : TcaSchemaFactory
$pageDoktypeRegistry : PageDoktypeRegistry
$flexFormTools : FlexFormTools
$passwordHashFactory : PasswordHashFactory
$randomGenerator : Random
$typoLinkCodecService : TypoLinkCodecService
$opcodeCacheService : OpcodeCacheService
$flashMessageService : FlashMessageService
$siteFinder : SiteFinder

addRemapAction()

Adds an instruction to the remap action stack (used with IRRE).

public addRemapAction(string $table, int|string $id, callable $callback, array $arguments) : void

Parameters

$table : string

The affected table

$id : int|string

The affected ID

$callback : callable

The callback information (object and method)

$arguments : array

The arguments to be used with the callback

checkRecordInsertAccess()

Unused. Removed in TYPO3 v14.

public checkRecordInsertAccess(string $insertTable, int $pid[, int $action = Database::INSERT ]) : bool

Parameters

$insertTable : string

Tablename to check

$pid : int

Integer PID

$action : int = Database::INSERT

For logging: Action number.

Return values

bool —

Returns TRUE if the user may insert a record from table $insertTable on page $pid

checkRecordUpdateAccess()

Unused. Removed in TYPO3 v14.

public checkRecordUpdateAccess(string $table, int $id) : bool

Parameters

$table : string

Record table

$id : int

Record UID

Return values

bool —

Returns TRUE if the user may update the record given by $table and $id

checkValue()

Evaluates a value according to $table/$field settings.

public checkValue(string $table, string $field, string $value, int|string $id, string $status, int $realPid, int $tscPID[, array $incomingFieldArray = [] ]) : array

This function is for real database fields - NOT FlexForm "pseudo" fields. NOTICE: Calling this function expects this: 1) That the data is saved!

Parameters

$table : string

Table name

$field : string

Field name

$value : string

Value to be evaluated. Notice, this is the INPUT value from the form. The original value (from any existing record) must be manually looked up inside the function if needed - or taken from $currentRecord array.

$id : int|string

The record-uid, mainly - but not exclusively - used for logging

$status : string

'update' or 'new' flag

$realPid : int

The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.

$tscPID : int

TSconfig PID

$incomingFieldArray : array = []

the fields being explicitly set by the outside (unlike $fieldArray)

Return values

array —

Returns the evaluated $value as key "value" in this array. Can be checked with isset($res['value']) ...

checkValue_category_processDBdata()

Returns processed data for category fields

public checkValue_category_processDBdata(array $valueArray, array $tcaFieldConf, string|int $id, string $status, string $table, string $field) : array

Parameters

$valueArray : array

Current value array

$tcaFieldConf : array

TCA field config

$id : string|int

Record id, used for look-up of MM relations (local_uid)

$status : string

Status string ('update' or 'new')

$table : string

Table name, needs to be passed to \TYPO3\CMS\Core\Database\RelationHandler

$field : string

field name, needs to be set for writing to sys_history

Return values

array —

Modified value array

checkValue_checkMax()

Checks if a fields has more items than defined via TCA in maxitems.

public checkValue_checkMax(array $tcaFieldConf, array $valueArray) : array

If there are more items than allowed, the item list is truncated to the defined number.

Parameters

$tcaFieldConf : array

Field configuration from TCA

$valueArray : array

Current value array of items

Return values

array —

The truncated value array of items

checkValue_flex_procInData()

Starts the processing the input data for flexforms. This will traverse all sheets / languages and for each it will traverse the sub-structure.

public checkValue_flex_procInData(array $dataPart, array $dataPart_current, array $dataStructure, array $pParams[, string $callBackFunc = '' ][, array $workspaceOptions = [] ]) : array|null

See checkValue_flex_procInData_travDS() for more details. WARNING: Currently, it traverses based on the actual data array and NOT the structure. This means that values for non-valid fields, lKey/vKey/sKeys will be accepted! For traversal of data with a call back function you should rather use \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools

Parameters

$dataPart : array

The 'data' part of the INPUT flexform data

$dataPart_current : array

The 'data' part of the CURRENT flexform data

$dataStructure : array

Data structure for the form (might be sheets or not). Only values in the data array which has a configuration in the data structure will be processed.

$pParams : array

A set of parameters to pass through for the calling of the evaluation functions

$callBackFunc : string = ''

Optional call back function, see checkValue_flex_procInData_travDS() DEPRECATED, use \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools instead for traversal!

$workspaceOptions : array = []

Tags

see
checkValue_flex_procInData_travDS()

Return values

array|null —

The modified 'data' part.

checkValue_flex_procInData_travDS()

Processing of the sheet/language data array When it finds a field with a value the processing is done by ->checkValue_SW() by default but if a call back function name is given that method in this class will be called for the processing instead.

public checkValue_flex_procInData_travDS(array &$dataValues, array $dataValues_current, array $DSelements, array $pParams, string $callBackFunc, string $structurePath[, array $workspaceOptions = [] ]) : void

Parameters

$dataValues : array

New values (those being processed): Multidimensional Data array for sheet/language, passed by reference!

$dataValues_current : array

Current values: Multidimensional Data array. May be empty array() if not needed (for callBackFunctions)

$DSelements : array

Data structure which fits the data array

$pParams : array

A set of parameters to pass through for the calling of the evaluation functions / call back function

$callBackFunc : string

Call back function, default is checkValue_SW(). If $this->callBackObj is set to an object, the callback function in that object is called instead.

$structurePath : string
$workspaceOptions : array = []

Tags

see
checkValue_flex_procInData()

checkValue_group_select_explodeSelectGroupValue()

Explodes the $value, which is a list of files/uids (group select)

public checkValue_group_select_explodeSelectGroupValue(string $value) : array

Parameters

$value : string

Input string, comma separated values. For each part it will also be detected if a '|' is found and the first part will then be used if that is the case. Further the value will be rawurldecoded.

Return values

array —

The value array.

checkValue_group_select_processDBdata()

Returns data for group/db and select fields

public checkValue_group_select_processDBdata(array $valueArray, array $tcaFieldConf, int $id, string $status, string $type, string $currentTable, string $currentField) : array

Parameters

$valueArray : array

Current value array

$tcaFieldConf : array

TCA field config

$id : int

Record id, used for look-up of MM relations (local_uid)

$status : string

Status string ('update' or 'new')

$type : string

The type, either 'select', 'group' or 'inline'

$currentTable : string

Table name, needs to be passed to \TYPO3\CMS\Core\Database\RelationHandler

$currentField : string

field name, needs to be set for writing to sys_history

Return values

array —

Modified value array

checkValue_inline()

Evaluates 'inline' type values.

public checkValue_inline(array $res, string $value, array $tcaFieldConf, array $PP, string $field[, array|null $additionalData = null ]) : mixed

(partly copied from the select_group function on this issue)

Parameters

$res : array

The result array. The processed value (if any!) is set in the 'value' key.

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$PP : array

Additional parameters in a numeric array: $table,$id,$curValue,$status,$realPid,$recFID

$field : string

Field name

$additionalData : array|null = null

Additional data to be forwarded to sub-processors

checkValue_input_Eval()

Evaluation of 'input'-type values based on 'eval' list

public checkValue_input_Eval(string $value, array $evalArray, string $is_in[, string $table = '' ][, string|int $id = '' ]) : array

Parameters

$value : string

Value to evaluate

$evalArray : array

Array of evaluations to traverse.

$is_in : string

Is-in string for 'is_in' evaluation

$table : string = ''

Table name the eval is evaluated on

$id : string|int = ''

Record ID the eval is evaluated on

Return values

array —

Modified $value in key 'value' or empty array

checkValue_SW()

Branches out evaluation of a field value based on its type as configured in $GLOBALS['TCA'] Can be called for FlexForm pseudo fields as well, BUT must not have $field set if so.

public checkValue_SW(array $res, string|null $value, array $tcaFieldConf, string $table, int $id, mixed $curValue, string $status, int $realPid, string $recFID, string $field, int $tscPID[, array|null $additionalData = null ]) : array

And hey, there's a good thing about the method arguments: 13 is prime :-P

Parameters

$res : array

The result array. The processed value (if any!) is set in the "value" key.

$value : string|null

The value to set.

$tcaFieldConf : array

Field configuration from $GLOBALS['TCA']

$table : string

Table name

$id : int

UID of record

$curValue : mixed

Current value of the field

$status : string

'update' or 'new' flag

$realPid : int

The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.

$recFID : string

Field identifier [table:uid:field] for flexforms

$field : string

Field name. Must NOT be set if the call is for a flexform field (since flexforms are not allowed within flexforms).

$tscPID : int

TSconfig PID

$additionalData : array|null = null

Additional data to be forwarded to sub-processors

Return values

array —

Returns the evaluated $value as key "value" in this array.

checkValue_text_Eval()

public checkValue_text_Eval(string $value, array $evalArray, string $is_in) : array

Parameters

$value : string

The field value to be evaluated

$evalArray : array

Array of evaluations to traverse.

$is_in : string

The "is_in" value of the field configuration from TCA

Return values

array

checkValueForFile()

Evaluates 'file' type values.

public checkValueForFile(array $res, string $value, array $tcaFieldConf, string $table, int|string $id, string $field[, array|null $additionalData = null ]) : array

Parameters

$res : array
$value : string
$tcaFieldConf : array
$table : string
$id : int|string
$field : string
$additionalData : array|null = null

Return values

array

checkValueForInline()

Evaluates 'inline' type values.

public checkValueForInline(array $res, string $value, array $tcaFieldConf, string $table, int|string $id, string $status, string $field[, array|null $additionalData = null ]) : array|false

(partly copied from the select_group function on this issue)

Parameters

$res : array

The result array. The processed value (if any!) is set in the 'value' key.

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

Table name

$id : int|string

UID of record

$status : string

'update' or 'new' flag

$field : string

Field name

$additionalData : array|null = null

Additional data to be forwarded to sub-processors

Return values

array|false —

Modified $res array

clear_cacheCmd()

Clears the cache based on the command $cacheCmd.

public clear_cacheCmd(int|string $cacheCmd) : void

$cacheCmd='pages' Clears cache for all pages and page-based caches inside the cache manager. Requires admin-flag to be set for BE_USER.

$cacheCmd='all' Clears all cache_tables. This is necessary if templates are updated. Requires admin-flag to be set for BE_USER.

The following cache_* are intentionally not cleared by 'all'

  • all caches inside the cache manager that are inside the group "system"
  • they are only needed to build up the core system and templates. If the group of system caches needs to be deleted explicitly, use flushCachesInGroup('system') of CacheManager directly.

$cacheCmd=[integer] Clears cache for the page pointed to by $cacheCmd (an integer).

$cacheCmd='cacheTag:[string]' Flush page cache by given tag

Can call a list of post processing functions as defined in $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'] (numeric array with values being the function references, called by GeneralUtility::callUserFunction()).

Parameters

$cacheCmd : int|string

The cache command, see above description

clearPrefixFromValue()

Removes the prependAtCopy prefix on values

public clearPrefixFromValue(string $table, string $value) : string

Parameters

$table : string

Table name

$value : string

The value to fix

Return values

string —

Clean name

compareFieldArrayWithCurrentAndUnset()

Compares the incoming field array with the current record and unsets all fields which are the same.

public compareFieldArrayWithCurrentAndUnset(string $table, int $id, array $fieldArray) : array

Used for existing records being updated

Parameters

$table : string

Record table name

$id : int

Record uid

$fieldArray : array

Array of field=>value pairs intended to be inserted into the database. All keys with values matching exactly the current value will be unset!

Return values

array —

Returns $fieldArray. If the returned array is empty, then the record should not be updated!

copyPages()

Copying pages Main function for copying pages.

public copyPages(int $uid, int $destPid) : void

Parameters

$uid : int

Page UID to copy

$destPid : int

Destination PID: >=0 then it points to a page-id on which to insert the record (as the first element). <0 then it points to a uid from its own table after which to insert it (works if

copyRecord()

Copying a single record

public copyRecord(string $table, int $uid, int $destPid[, bool $first = false ][, array $overrideValues = [] ][, string $excludeFields = '' ][, int $language = 0 ][, bool $ignoreLocalization = false ]) : int|null

Parameters

$table : string

Element table

$uid : int

Element UID

$destPid : int

=0 then it points to a page-id on which to insert the record (as the first element). <0 then it points to a uid from its own table after which to insert it (works if

$first : bool = false

Is a flag set, if the record copied is NOT a 'slave' to another record copied. That is, if this record was asked to be copied in the cmd-array

$overrideValues : array = []

Associative array with field/value pairs to override directly. Notice; Fields must exist in the table record and NOT be among excluded fields!

$excludeFields : string = ''

Commalist of fields to exclude from the copy process (might get default values)

$language : int = 0

Language ID

$ignoreLocalization : bool = false

If TRUE, any localization routine is skipped

Return values

int|null —

ID of new record, if any

copyRecord_flexFormCallBack()

Callback function for traversing the FlexForm structure in relation to creating copied files of file relations inside of flex form structures.

public copyRecord_flexFormCallBack(array $pParams, array $dsConf, string $dataValue, string $_1, string $_2, array $workspaceOptions) : array

Parameters

$pParams : array

Array of parameters in num-indexes: table, uid, field

$dsConf : array

TCA field configuration (from Data Structure XML)

$dataValue : string

The value of the flexForm field

$_1 : string

Not used.

$_2 : string

Not used.

$workspaceOptions : array

Tags

see
copyRecord()
see
checkValue_flex_procInData_travDS()

Return values

array —

Result array with key "value" containing the value of the processing.

copyRecord_procBasedOnFieldType()

Processing/Preparing content for copyRecord() function

public copyRecord_procBasedOnFieldType(string $table, int $uid, string $field, string|null $value, array $row, array $conf, int $realDestPid[, int $language = 0 ][, array $workspaceOptions = [] ]) : array|string|null

Parameters

$table : string

Table name

$uid : int

Record uid

$field : string

Field name being processed

$value : string|null

Input value to be processed.

$row : array

Record array

$conf : array

TCA field configuration

$realDestPid : int

Real page id (pid) the record is copied to

$language : int = 0

Language ID used in the duplicated record

$workspaceOptions : array = []

Options to be forwarded if actions happen on a workspace currently

Tags

see
copyRecord()

Return values

array|string|null

copyRecord_raw()

Copying records, but makes a "raw" copy of a record.

public copyRecord_raw(string $table, int $uid, int $pid[, array $overrideArray = [] ][, array $workspaceOptions = [] ]) : int|null

Basically the only thing observed is field processing like the copying of files and correction of ids. All other fields are 1-1 copied. Technically the copy is made with THIS instance of the DataHandler class contrary to copyRecord() which creates a new instance and uses the processData() function. The copy is created by insertNewCopyVersion() which bypasses most of the regular input checking associated with processData() - maybe copyRecord() should even do this as well!? This function is used to create new versions of a record. NOTICE: DOES NOT CHECK PERMISSIONS to create! And since page permissions are just passed through and not changed to the user who executes the copy we cannot enforce permissions without getting an incomplete copy - unless we change permissions of course.

Parameters

$table : string

Element table

$uid : int

Element UID

$pid : int

Element PID (real PID, not checked)

$overrideArray : array = []

Override array - must NOT contain any fields not in the table!

$workspaceOptions : array = []

Options to be forwarded if actions happen on a workspace currently

Return values

int|null —

Returns the new ID of the record (if applicable)

copySpecificPage()

Copying a single page ($uid) to $destPid and all tables in the array copyTablesArray.

public copySpecificPage(int $uid, int $destPid, array $copyTablesArray[, bool $first = false ]) : int|null

Parameters

$uid : int

Page uid

$destPid : int

Destination PID: >=0 then it points to a page-id on which to insert the record (as the first element). <0 then it points to a uid from its own table after which to insert it (works if

$copyTablesArray : array

Table on pages to copy along with the page.

$first : bool = false

Is a flag set, if the record copied is NOT a 'slave' to another record copied. That is, if this record was asked to be copied in the cmd-array

Return values

int|null —

The id of the new page, if applicable.

dbAnalysisStoreExec()

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

public dbAnalysisStoreExec() : void

deleteAction()

Delete a single record.

public deleteAction(string $table, int|array $uidOrRow[, bool $noRecordCheck = false ][, bool $forceHardDelete = false ]) : void

Parameters

$table : string
$uidOrRow : int|array
$noRecordCheck : bool = false
$forceHardDelete : bool = false

deleteClause()

Unused. Removed in TYPO3 v14.

public deleteClause(mixed $table) : string

Parameters

$table : mixed

Return values

string

deleteEl()

Delete element from any table

public deleteEl(string $table, int|array $uidOrRow[, bool $noRecordCheck = false ][, bool $forceHardDelete = false ]) : void

Parameters

$table : string
$uidOrRow : int|array
$noRecordCheck : bool = false

If true, records are not checked for permissions

$forceHardDelete : bool = false

If true, the "deleted" flag is ignored if applicable for record and the record is deleted COMPLETELY!

deleteL10nOverlayRecords()

Find l10n-overlay records and perform the requested delete action for these records.

public deleteL10nOverlayRecords(string $table, int $uid[, bool $forceHardDelete = false ]) : void

Parameters

$table : string
$uid : int
$forceHardDelete : bool = false

deleteRecord()

Deleting a record This function may not be used to delete pages-records unless the underlying records are already deleted Deletes a record regardless of versioning state (live or offline, doesn't matter, the uid decides) If both $noRecordCheck and $forceHardDelete are set it could even delete a "deleted"-flagged record!

public deleteRecord(string $table, int|array $uidOrRow[, bool $noRecordCheck = false ][, bool $forceHardDelete = false ]) : void

Parameters

$table : string

Table name

$uidOrRow : int|array

record uid or full record row

$noRecordCheck : bool = false

Flag: If $noRecordCheck is set, then the function does not check permission to delete record

$forceHardDelete : bool = false

If TRUE, the "deleted" flag is ignored if applicable for record and the record is deleted COMPLETELY!

destNotInsideSelf()

Checks if page $id is a uid in the rootline of page id $destinationId Used when moving a page

public destNotInsideSelf(int $destinationId, int $id) : bool

Parameters

$destinationId : int

Destination Page ID to test

$id : int

Page ID to test for presence inside Destination

Return values

bool —

Returns FALSE if ID is inside destination (including equal to)

disableDeleteClause()

Unused. Removed in TYPO3 v14.

public disableDeleteClause() : void

doesPageHaveUnallowedTables()

Checks if there are records on a page from tables that are not allowed

public doesPageHaveUnallowedTables(int|string $page_uid, int $doktype) : array

Parameters

$page_uid : int|string

Page ID

$doktype : int

Page doktype

Return values

array —

Returns a list of the tables that are 'present' on the page but not allowed with the page_uid/doktype

fillInFieldArray()

Filling in the field array $this->excludedTablesAndFields is used to filter fields if needed.

public fillInFieldArray(string $table, int|string $id, array $fieldArray, array $incomingFieldArray, int $realPid, string $status, int $tscPID) : array

Parameters

$table : string
$id : int|string

Record ID

$fieldArray : array

Default values, Preset $fieldArray with 'pid' maybe (pid and uid will be not be overridden anyway)

$incomingFieldArray : array

Is which fields/values you want to set. There are processed and put into $fieldArray if OK

$realPid : int

The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.

$status : string

Is 'new' or 'update'

$tscPID : int

TSconfig PID

Return values

array

fixUniqueInPid()

Checks if any uniqueInPid eval input fields are in the record and if so, they are re-written to be correct.

public fixUniqueInPid(string $table, mixed $uidOrRow) : void

Parameters

$table : string
$uidOrRow : mixed

getAutoVersionId()

Gets the automatically versionized id of a record.

public getAutoVersionId(string $table, int $id) : int|null

Parameters

$table : string

Name of the table

$id : int

Uid of the record

Return values

int|null

getCopyHeader()

Get modified header for a copied record

public getCopyHeader(string $table, int $pid, string $field, string $value, int $count[, string $prevTitle = '' ]) : string

Parameters

$table : string

Table name

$pid : int

PID value in which other records to test might be

$field : string

Field name to get header value for.

$value : string

Current field value

$count : int

Counter (number of recursions)

$prevTitle : string = ''

Previous title we checked for (in previous recursion)

Return values

string —

The field value, possibly appended with a "copy label

getExcludeListArray()

Generate an array of fields to be excluded from editing for the user. Based on "exclude"-field in TCA and a look up in non_exclude_fields Will also generate this list for admin-users so they must be check for before calling the function

public getExcludeListArray() : array

Return values

array —

Array of [table]-[field] pairs to exclude from editing.

getHistoryRecords()

public getHistoryRecords() : array

Return values

array

getPID()

Unused. Removed in TYPO3 v14.

public getPID(mixed $table, mixed $uid) : mixed

Parameters

$table : mixed
$uid : mixed

getRecordProperties()

Unused. Removed in TYPO3 v14.

public getRecordProperties(string $table, int $id[, bool $noWSOL = false ]) : array|null

Parameters

$table : string

Table name

$id : int

Uid of record

$noWSOL : bool = false

If set, no workspace overlay is performed

Return values

array|null —

Properties of record

getRecordPropertiesFromRow()

Unused. Removed in TYPO3 v14.

public getRecordPropertiesFromRow(string $table, array $row) : array|null

Parameters

$table : string

Table name

$row : array

Input row

Return values

array|null —

Output array

getRecordsWithSameValue()

gets all records that have the same value in a field excluding the given uid

public getRecordsWithSameValue(string $tableName, int $uid, string $fieldName, string|int $value[, int $pageId = 0 ]) : array

Parameters

$tableName : string

Table name

$uid : int

UID to filter out in the lookup (the record itself...)

$fieldName : string

Field name for which $value must be unique

$value : string|int

Value string.

$pageId : int = 0

If set, the value will be unique for this PID

Return values

array

getRelationFieldType()

Returns the subtype as a string of a relation (inline / file) field.

public getRelationFieldType(array $conf) : string|bool

If it's not a relation field at all, it returns FALSE.

Parameters

$conf : array

Config array for TCA/columns field

Return values

string|bool —

string Inline subtype (field|mm|list), boolean: FALSE

getTableEntries()

Extract entries from TSconfig for a specific table. This will merge specific and default configuration together.

public getTableEntries(string $table, array $TSconfig) : array

Parameters

$table : string

Table name

$TSconfig : array

TSconfig for page

Return values

array —

TSconfig merged

getUnique()

Gets a unique value for $table/$id/$field based on $value

public getUnique(string $table, string $field, string $value, int $id[, int $newPid = 0 ]) : string

Parameters

$table : string

Table name

$field : string

Field name for which $value must be unique

$value : string

Value string.

$id : int

UID to filter out in the lookup (the record itself...)

$newPid : int = 0

If set, the value will be unique for this PID

Tags

todo:

consider workspaces, especially when publishing a unique value which has a unique value already in live

Return values

string —

Modified value (if not-unique). Will be the value appended with a number (until 100, then the function just breaks).

getVersionizedIncomingFieldArray()

If a parent record was versionized on a workspace in $this->process_datamap, it might be possible, that child records (e.g. on using IRRE) were affected.

public getVersionizedIncomingFieldArray(string $table, int $id, array &$incomingFieldArray, array &$registerDBList) : void

This function finds these relations and updates their uids in the $incomingFieldArray. The $incomingFieldArray is updated by reference!

Parameters

$table : string

Table name of the parent record

$id : int

Uid of the parent record

$incomingFieldArray : array

Reference to the incomingFieldArray of process_datamap

$registerDBList : array

Reference to the $registerDBList array that was created/updated by versionizing calls to DataHandler in process_datamap.

hasPageContextPermission()

Checks whether the current backend user holds the requested permissions for a record of $table in the context of the given page.

public hasPageContextPermission(string $table, int $perms, array $page[, bool $useDeleteClause = true ]) : bool

When $page is a VirtualRecord the standard page-permission bitmask check is bypassed. For VirtualRecord::RootPage the table's root-level restriction capability (security.ignoreRootLevelRestriction) is consulted instead; if the table opts out of the restriction, access is granted unconditionally.

Parameters

$table : string

Table name of the record on the particular page to be checked

$perms : int

Permission restrictions to observe. An integer bitmask of Permission constants

$page : array

Full page record

$useDeleteClause : bool = true

Use the delete clause to check if the page is deleted

Return values

bool

hasPagePermission()

public hasPagePermission(int $perms, array $page[, bool $useDeleteClause = true ]) : bool

Deprecated

will be removed in TYPO3 v15.0 (it was always internal -> no deprecation logging)

Parameters

$perms : int
$page : array
$useDeleteClause : bool = true

Return values

bool

hasPermissionToUpdate()

Checks if user may update a record $table on given page record

public hasPermissionToUpdate(string $table, array|VirtualRecord $pageRecord) : bool

Parameters

$table : string
$pageRecord : array|VirtualRecord

Return values

bool

hook_processDatamap_afterDatabaseOperations()

Hook: processDatamap_afterDatabaseOperations (calls $hookObj->processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, $this);)

public hook_processDatamap_afterDatabaseOperations(array $hookObjectsArr, string $status, string &$table, string &$id, array &$fieldArray) : void

Note: When using the hook after INSERT operations, you will only get the temporary NEW... id passed to your hook as $id, but you can easily translate it to the real uid of the inserted record using the $this->substNEWwithIDs array.

Parameters

$hookObjectsArr : array

(reference) Array with hook objects

$status : string

(reference) Status of the current operation, 'new' or 'update

$table : string

(reference) The table currently processing data for

$id : string

(reference) The record uid currently processing data for, [integer] or [string] (like 'NEW...')

$fieldArray : array

(reference) The field array of a record

insertDB()

Insert into database Does not check permissions but expects them to be verified on beforehand

public insertDB(string $table, string $id, array $fieldArray[, null $_ = null ][, mixed $suggestedUid = 0 ]) : int|null

Parameters

$table : string

Record table name

$id : string

"NEW...." uid string

$fieldArray : array

Array of field=>value pairs to insert. FIELDS MUST MATCH the database FIELDS. No check is done. "pid" must point to the destination of the record!

$_ : null = null

unused

$suggestedUid : mixed = 0

Return values

int|null —

Returns ID on success.

insertNewCopyVersion()

Inserts a record in the database, passing TCA configuration values through checkValue() but otherwise does NOTHING and checks nothing regarding permissions.

public insertNewCopyVersion(string $table, array $fieldArray, int $realPid) : int|null

Passes the "version" parameter to insertDB() so the copy will look like a new version in the log - should probably be changed or modified a bit for more broad usage...

Parameters

$table : string

Table name

$fieldArray : array

Field array to insert as a record

$realPid : int

The value of PID field.

Return values

int|null —

Returns the new ID of the record (if applicable)

insertUpdateDB_preprocessBasedOnFieldType()

Preprocesses field array based on field type. Some fields must be adjusted before going to database. This is done on the copy of the field array because original values are used in remap action later.

public insertUpdateDB_preprocessBasedOnFieldType(string $table, array $fieldArray) : array

Parameters

$table : string

Table name

$fieldArray : array

Field array to check

Return values

array —

Updated field array

int_pageTreeInfo()

Returns array, $CPtable, of pages under the $pid going down to $counter levels.

public int_pageTreeInfo(array $CPtable, int $pid, int $counter, int $rootID) : array

Selecting ONLY pages which the user has read-access to!

Parameters

$CPtable : array

Accumulation of page uid=>pid pairs in branch of $pid

$pid : int

Page ID for which to find subpages

$counter : int

Number of levels to go down.

$rootID : int

ID of root point for new copied branch: The idea seems to be that a copy is not made of the already new page!

Return values

array —

Return array.

isInWebMount()

Unused. Removed in TYPO3 v14.

public isInWebMount(int $pid) : bool

Parameters

$pid : int

Page ID to check

Return values

bool —

TRUE if OK. Cached results.

isOuterMostInstance()

Determines whether this object is the outermost instance of itself Since DataHandler can create nested objects of itself, this method helps to determine the first (= outermost) one.

public isOuterMostInstance() : bool

Return values

bool

isRecordCopied()

Determine if a record was copied or if a record is the result of a copy action.

public isRecordCopied(string $table, int $uid) : bool

Parameters

$table : string

The tablename of the record

$uid : int

The uid of the record

Return values

bool —

Returns TRUE if the record is copied or is the result of a copy action

isRecordInWebMount()

Unused. Removed in TYPO3 v14.

public isRecordInWebMount(string $table, int $id) : bool

Parameters

$table : string

Table name

$id : int

UID of record

Return values

bool —

Returns TRUE if OK. Cached results.

isReferenceField()

Returns TRUE if the TCA/columns field type is a DB reference field

public isReferenceField(array $conf) : bool

Parameters

$conf : array

Config array for TCA/columns field

Return values

bool —

TRUE if DB reference field (group/db or select with foreign-table)

localize()

Localizes a record to another system language

public localize(string $table, int $uid, int $language) : int|bool

Parameters

$table : string

Table name

$uid : int

Record uid (to be localized)

$language : int

Language ID

Return values

int|bool —

The uid (int) of the new translated record or FALSE (bool) if something went wrong

log()

Logging actions from DataHandler

public log(string $table, int $recuid, int $action, null $_, int $error, string $details[, null $__ = null ][, array $data = [] ][, int $event_pid = -1 ]) : int

Parameters

$table : string

Table name the log entry is concerned with. Blank if NA

$recuid : int

Record UID. Zero if NA

$action : int

Action number: 0=No category, 1=new record, 2=update record, 3= delete record, 4= move record, 5= Check/evaluate

$_ : null

unused

$error : int

The severity: 0 = message, 1 = error, 2 = System Error, 3 = security notice (admin), 4 warning

$details : string

Default error message in english

$__ : null = null

unused

$data : array = []

Array with special information that may go into $details by '%s' marks / sprintf() when the log is shown

$event_pid : int = -1

The page_uid (pid) where the event occurred. Used to select log-content for specific pages.

Return values

int —

Log entry UID (0 if no log entry was written or logging is disabled)

moveL10nOverlayRecords()

Find l10n-overlay records and perform the requested move action for these records.

public moveL10nOverlayRecords(string $table, int $uid, int $destPid, int $originalRecordDestinationPid) : void

Parameters

$table : string

Record Table

$uid : int

Record UID

$destPid : int

Position to move to

$originalRecordDestinationPid : int

Position to move the original record to

moveRecord()

Move a single record.

public moveRecord(string $table, mixed $uid, int $destination) : void

Parameters

$table : string
$uid : mixed
$destination : int

Position to move to. If >=0, then it points to a page uid on which to insert the record as the first element. If <0, then it points to an uid from its own table after which the record should be moved to.

moveRecord_procBasedOnFieldType()

Unused. Removed in TYPO3 v14.

public moveRecord_procBasedOnFieldType(string $table, int $uid, int $destPid, string $value, array $conf) : void

Parameters

$table : string

Record Table

$uid : int

Record UID

$destPid : int

Position to move to

$value : string

Record field value

$conf : array

TCA configuration of current field

moveRecord_procFields()

Unused. Removed in TYPO3 v14.

public moveRecord_procFields(string $table, int $uid, int $destPid) : void

Parameters

$table : string

Record Table

$uid : int

Record UID

$destPid : int

Position to move to

moveRecord_raw()

Unused. Removed in TYPO3 v14.

public moveRecord_raw(string $table, int $uid, int $destPid) : void

Parameters

$table : string

Table name to move

$uid : int

Record uid to move

$destPid : int

Position to move to: $destPid: >=0 then it points to a page-id on which to insert the record (as the first element). <0 then it points to a uid from its own table after which to insert it (works if

newFieldArray()

Returns a fieldArray with default values. Values will be picked up from the TCA array looking at the config key "default" for each column. If values are set in ->defaultValues they will overrule though. Used for new records and during copy operations for defaults.

public newFieldArray(string $table) : array

Parameters

$table : string

Table name for which to set default values.

Return values

array —

Array with default values.

printLogErrorMessages()

Print log error messages from the operations of this script instance and return a list of the erroneous records

public printLogErrorMessages() : non-empty-string[]

Return values

non-empty-string[]

process_cmdmap()

Processing the cmd-array See "TYPO3 Core API" for a description of the options.

public process_cmdmap() : void|bool

Return values

void|bool

process_datamap()

Processing the data-array Call this function to process the data-array set by start()

public process_datamap() : void

processRemapStack()

Processes the $this->remapStack at the end of copying, inserting, etc. actions.

public processRemapStack() : void

The remapStack takes care about the correct mapping of new and old uids in case of relational data.

recordInfo()

Unused. Removed in TYPO3 v14.

public recordInfo(string $table, int $id) : array|null

Parameters

$table : string

Table name

$id : int

UID of the record from $table

Return values

array|null —

Returns the selected record on success, otherwise NULL.

recordInfoWithPermissionCheck()

Unused. Removed in TYPO3 v14.

public recordInfoWithPermissionCheck(string $table, int $id, int $perms) : array<string, mixed>|false

Parameters

$table : string

Record table name

$id : int

Record UID

$perms : int

Permission restrictions to observe: An integer that will be bitwise AND'ed.

Return values

array<string, mixed>|false —

Row if exists and accessible, false otherwise

registerRecordIdForPageCacheClearing()

Clearing the cache based on a page being updated If the $table is 'pages' then cache is cleared for all pages on the same level (and subsequent?) Else just clear the cache for the parent page of the record.

public registerRecordIdForPageCacheClearing(string $table, int $uid[, int $pid = null ]) : void

Parameters

$table : string

Table name of record that was just updated.

$uid : int

UID of updated / inserted record

$pid : int = null

REAL PID of page of a deleted/moved record to get TSconfig in ClearCache.

registerReferenceIndexRowsForDrop()

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 registerReferenceIndexRowsForDrop(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

registerReferenceIndexUpdateForReferencesToItem()

Helper method to access referenceIndexUpdater->registerUpdateForReferencesToItem() from within workspace DataHandlerHook.

public registerReferenceIndexUpdateForReferencesToItem(string $table, int $uid, int $workspace[, int|null $targetWorkspace = null ]) : void

Parameters

$table : string
$uid : int
$workspace : int
$targetWorkspace : int|null = null

remapListedDBRecords()

Processes the fields with references as registered during the copy process. This includes all FlexForm fields which had references.

public remapListedDBRecords() : void

remapListedDBRecords_flexFormCallBack()

Callback function for traversing the FlexForm structure in relation to creating copied files of file relations inside of flex form structures.

public remapListedDBRecords_flexFormCallBack(array $pParams, array $dsConf, string $dataValue) : array

Parameters

$pParams : array

Set of parameters in numeric array: table, uid, field

$dsConf : array

TCA config for field (from Data Structure of course)

$dataValue : string

Field value (from FlexForm XML)

Tags

see
checkValue_flex_procInData_travDS()
see
remapListedDBRecords()

Return values

array —

Array where the "value" key carries the value.

remapListedDBRecords_procDBRefs()

Performs remapping of old UID values to NEW uid values for a DB reference field.

public remapListedDBRecords_procDBRefs(array $conf, string $value, int $MM_localUid, string $table) : array|null

Parameters

$conf : array

TCA field config

$value : string

Field value

$MM_localUid : int

UID of local record (for MM relations - might need to change if support for FlexForms should be done!)

$table : string

Table name

Tags

see
remapListedDBRecords()

Return values

array|null —

Returns array of items ready to implode for field content.

remapListedDBRecords_procFile()

Performs remapping of old UID values to NEW uid values for an file field.

public remapListedDBRecords_procFile(mixed $conf, mixed $value, mixed $uid, mixed $table) : void

Parameters

$conf : mixed
$value : mixed
$uid : mixed
$table : mixed

remapListedDBRecords_procInline()

Performs remapping of old UID values to NEW uid values for an inline field.

public remapListedDBRecords_procInline(array $conf, string $value, int $uid, string $table) : void

Parameters

$conf : array

TCA field config

$value : string

Field value

$uid : int

The uid of the ORIGINAL record

$table : string

Table name

resolvePid()

Get the final pid based on $table and $pid ($destPid type... pos/neg)

public resolvePid(string $table, int $pid) : int

Parameters

$table : string

Table name

$pid : int

"Destination pid": If the value is >= 0 it's just returned directly (through (int)though) but if the value is <0 then the method looks up the record with the uid equal to abs($pid) (positive number) and returns the PID of that record! The idea is that negative numbers point to the record AFTER WHICH the position is supposed to be!

Return values

int

setControl()

public setControl(array $control) : void

Parameters

$control : array

setDefaultsFromUserTS()

Initializes default values coming from user TSconfig

public setDefaultsFromUserTS(array $userTS) : void

Parameters

$userTS : array

User TSconfig array

setHistory()

Setting sys_history record, based on content previously set in $this->historyRecords[$table . ':' . $id] (by compareFieldArrayWithCurrentAndUnset())

public setHistory(string $table, int $id) : void

This functionality is now moved into the RecordHistoryStore and can be used instead.

Parameters

$table : string

Table name

$id : int

Record ID

setMirror()

Function that can mirror input values in datamap-array to other uid numbers.

public setMirror(array $mirror) : void

Example: $mirror[table][11] = '22,33' will look for content in $this->datamap[table][11] and copy it to $this->datamap[table][22] and $this->datamap[table][33]

Parameters

$mirror : array

This array has the syntax $mirror[table_name][uid] = [list of uids to copy data-value TO!]

start()

Initializing.

public start(array $dataMap, array $commandMap[, BackendUserAuthentication|null $backendUser = null ][, ReferenceIndexUpdater|null $referenceIndexUpdater = null ]) : void

For details, see 'TYPO3 Core API' document. This method does not start the processing of data, but merely initializes the object.

Parameters

$dataMap : array

Data to be modified or inserted in the database

$commandMap : array

Commands to copy, move, delete, localize, versionize records.

$backendUser : BackendUserAuthentication|null = null

An alternative user, default is $GLOBALS['BE_USER']

$referenceIndexUpdater : ReferenceIndexUpdater|null = null

updateDB()

Update database record Does not check permissions but expects them to be verified on beforehand

public updateDB(string $table, int $uid, array $fieldArray[, int $recordPid = 0 ]) : void

Parameters

$table : string

Record table name

$uid : int

Record uid

$fieldArray : array

Array of field=>value pairs to insert. FIELDS MUST MATCH the database FIELDS. No check is done.

$recordPid : int = 0

updateRefIndex()

Register a table/uid combination in current user workspace for reference updating.

public updateRefIndex(string $table, int $uid[, int|null $workspace = null ]) : void

Should be called on almost any update to a record which could affect references inside the record.

Parameters

$table : string

Table name

$uid : int

Record UID

$workspace : int|null = null

Workspace the record lives in

versionizeRecord()

Creates a new version of a record if the table is workspace aware.

public versionizeRecord(mixed $table, int $id, string $label[, bool $delete = false ]) : int|null

Parameters

$table : mixed
$id : int

Live record uid to create a versioned record from

$label : string

Version label

$delete : bool = false

If TRUE, the version is created to delete the record.

Return values

int|null —

Returns the id of the new version (if any)

versionPublishManyToManyRelations()

Handle MM relations attached to a record when publishing a workspace record.

public versionPublishManyToManyRelations(string $table, array $liveRecord, array $workspaceRecord, int $fromWorkspace) : void

Strategy:

  • Find all MM tables the record can be attached to by scanning TCA. Handle flex form "first level" fields too, but skip scanning for MM relations in container sections, since core does not support that since v7 - FormEngine throws an exception in this case.
  • For each found MM table: Delete current MM rows of the live record, and update MM rows of the workspace record to now point to the live record.

Parameters

$table : string
$liveRecord : array
$workspaceRecord : array
$fromWorkspace : int

workspaceCannotEditOfflineVersion()

Evaluates if a user is allowed to edit the offline version

public workspaceCannotEditOfflineVersion(string $table, array $record) : string

Parameters

$table : string

Table of record

$record : array

array where fields are at least: pid, t3ver_wsid, t3ver_stage (if versioningWS is set)

Return values

string —

String error code, telling the failure state. FALSE=All ok

workspaceCannotEditRecord()

Checking if editing of an existing record is allowed in current workspace if that is offline.

public workspaceCannotEditRecord(string $table, array|int $recData) : string|false

Rules for editing in offline mode:

  • record supports versioning and is an offline version from workspace and has the current stage
  • or record (any) is in a branch where there is a page which is a version from the workspace and where the stage is not preventing records

Parameters

$table : string

Table of record

$recData : array|int

Integer (record uid) or array where fields are at least: pid, t3ver_wsid, t3ver_oid, t3ver_stage (if versioningWS is set)

Return values

string|false —

String error code, telling the failure state. FALSE=All ok

addDefaultPermittedLanguageIfNotSet()

If a "languageField" is specified for $table this function will add a possible value to the incoming array if none is found in there already.

protected addDefaultPermittedLanguageIfNotSet(string $table, array $incomingFieldArray, int $pageId) : array

Parameters

$table : string
$incomingFieldArray : array
$pageId : int

Return values

array

applyDefaultsForFieldArray()

When a new record is created, all values that haven't been set but are set via PageTSconfig / UserTSconfig get applied here.

protected applyDefaultsForFieldArray(string $table, int $pageId, array $prepopulatedFieldArray) : array

This is only executed for new records. The most important part is that the pageTS of the actual resolved $pid is taken, and a new field array with empty defaults is set again.

Parameters

$table : string
$pageId : int
$prepopulatedFieldArray : array

Return values

array

applyFiltersToValues()

Applies the filter methods from a column's TCA configuration to a value array.

protected applyFiltersToValues(array $tcaFieldConfiguration, array $values) : array|mixed

Parameters

$tcaFieldConfiguration : array
$values : array

Tags

throws
RuntimeException

Return values

array|mixed

canDeletePage()

Evaluate if a page can be deleted. Checks access to page and sub pages, and access to records on them.

protected canDeletePage(array $pageRecord, array $defaultLanguagePageRecord, array $subPages[, bool $useDeleteClause = true ]) : string|null

Parameters

$pageRecord : array

The page record to delete

$defaultLanguagePageRecord : array

The default language page record if $pageRecord is a localization. Identical to $pageRecord if $pageRecord is a default language record

$subPages : array

List of subpages. Only set if a default language page record should be deleted.

$useDeleteClause : bool = true

Use the delete clause to check if the page is deleted

Return values

string|null

castReferenceValue()

Casts a reference value. In case MM relations or foreign_field references are used. All other configurations, as well as foreign_table(!) could be stored as comma-separated-values as well. Since the system is not able to determine the default value automatically then, the TCA default value is used if it has been defined.

protected castReferenceValue(int|string $value, array $configuration, bool $isNew) : int|string

Parameters

$value : int|string

The value to be casted (e.g. '', '0', '1,2,3')

$configuration : array

The TCA configuration of the accordant field

$isNew : bool

is the record new or not

Return values

int|string

checkModifyAccessList()

Check user/group for modify table permission of a given table.

protected checkModifyAccessList(string $table) : bool

Parameters

$table : string

Return values

bool

checkValue_file_processDBdata()

Returns data for file fields.

protected checkValue_file_processDBdata(mixed $valueArray, mixed $tcaFieldConf, mixed $id, mixed $table) : mixed

Parameters

$valueArray : mixed
$tcaFieldConf : mixed
$id : mixed
$table : mixed

checkValue_inline_processDBdata()

Returns data for inline fields.

protected checkValue_inline_processDBdata(array $valueArray, array $tcaFieldConf, int $id, string $status, string $table, string $field) : string

Parameters

$valueArray : array

Current value array

$tcaFieldConf : array

TCA field config

$id : int

Record id

$status : string

Status string ('update' or 'new')

$table : string

Table name, needs to be passed to \TYPO3\CMS\Core\Database\RelationHandler

$field : string

The current field the values are modified for

Return values

string —

Modified values

checkValueForCategory()

Evaluate 'category' type values

protected checkValueForCategory(array $result, string $value, array $tcaFieldConf, string $table, int|string $id, string $status, string $field) : array

Parameters

$result : array

The result array. The processed value (if any!) is set in the 'value' key.

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

Table name

$id : int|string

uid of record

$status : string

The status - 'update' or 'new' flag

$field : string

Field name

Return values

array

checkValueForCheck()

Evaluates 'check' type values.

protected checkValueForCheck(array $res, string $value, array $tcaFieldConf, string $table, int $id, int $realPid, string $field) : array

Parameters

$res : array

The result array. The processed value (if any!) is set in the 'value' key.

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

Table name

$id : int

UID of record

$realPid : int

The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.

$field : string

Field name

Return values

array —

Modified $res array

checkValueForColor()

Evaluate "color" type values.

protected checkValueForColor(string $value, array $tcaFieldConf) : array

Parameters

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

Return values

array —

$res The result array. The processed value (if any!) is set in the "value" key.

checkValueForDatetime()

Evaluate 'datetime' type values

protected checkValueForDatetime(mixed $value, array $tcaFieldConf) : array

Parameters

$value : mixed

The value to set.

$tcaFieldConf : array

Field configuration from TCA

Return values

array

checkValueForEmail()

Evaluate "email" type values.

protected checkValueForEmail(string $value, array $tcaFieldConf, string $table, int|string $id, int $realPid, string $field) : array

Parameters

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

Table name

$id : int|string

UID of record - might be a NEW.. string for new records

$realPid : int

The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.

$field : string

Field name

Return values

array —

$res The result array. The processed value (if any!) is set in the "value" key.

checkValueForFlex()

Evaluates 'flex' type values.

protected checkValueForFlex(array $res, string|array $value, array $tcaFieldConf, string $table, int $id, mixed $curValue, string $status, int $realPid, string $recFID, int $tscPID, string $field) : array

Parameters

$res : array

The result array. The processed value (if any!) is set in the 'value' key.

$value : string|array

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

Table name

$id : int

UID of record

$curValue : mixed

Current value of the field

$status : string

'update' or 'new' flag

$realPid : int

The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.

$recFID : string

Field identifier [table:uid:field] for flexforms

$tscPID : int

TSconfig PID

$field : string

Field name

Return values

array —

Modified $res array

checkValueForGroupFolderSelect()

Evaluates 'group', 'folder' or 'select' type values.

protected checkValueForGroupFolderSelect(array $res, string|array $value, array $tcaFieldConf, string $table, int $id, string $status, string $field) : array

Parameters

$res : array

The result array. The processed value (if any!) is set in the 'value' key.

$value : string|array

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

Table name

$id : int

UID of record

$status : string

'update' or 'new' flag

$field : string

Field name

Return values

array —

Modified $res array

checkValueForInput()

Evaluate "input" type values.

protected checkValueForInput(string $value, array $tcaFieldConf, string $table, int $id, int $realPid, string $field) : array

Parameters

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

Table name

$id : int

UID of record

$realPid : int

The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.

$field : string

Field name

Return values

array —

$res The result array. The processed value (if any!) is set in the "value" key.

checkValueForInternalReferences()

Checks values that are used for internal references. If the provided $value is a NEW-identifier, the direct processing is stopped. Instead, the value is forwarded to the remap-stack to be post-processed and resolved into a proper UID after all data has been resolved.

protected checkValueForInternalReferences(array $res, string $value, array $tcaFieldConf, string $table, int|string $id, string $field) : array

This method considers TCA types that cannot handle and resolve these internal values directly, like 'passthrough', 'none' or 'user'. Values are only modified here if the $field is used as 'transOrigPointerField' or 'translationSource'.

Parameters

$res : array

The result array. The processed value (if any!) is set in the 'value' key.

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

Table name

$id : int|string

UID of record

$field : string

The field name

Return values

array —

The result array. The processed value (if any!) is set in the "value" key.

checkValueForJson()

Evaluate "json" type values.

protected checkValueForJson(array|string|null $value, array $tcaFieldConf) : array

Parameters

$value : array|string|null

The value to set.

$tcaFieldConf : array

Field configuration from TCA

Return values

array —

The result array. The processed value (if any!) is set in the "value" key.

checkValueForLanguage()

Evaluate "language" type value.

protected checkValueForLanguage(int $value, string $table, string $field) : array

Checks whether the user is allowed to add such a value as language

Parameters

$value : int

The value to set.

$table : string

Table name

$field : string

Field name

Return values

array —

$res The result array. The processed value (if any!) is set in the "value" key.

Evaluate "link" type values.

protected checkValueForLink(string $value, array $tcaFieldConf, string $table, int|string $id, string $field) : array

Parameters

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

Table name

$id : int|string

UID of record - might be a NEW.. string for new records

$field : string

The name of the current field

Return values

array —

The result array. The processed value (if any!) is set in the "value" key.

checkValueForNumber()

Evaluate 'number' type values

protected checkValueForNumber(mixed $value, array $tcaFieldConf) : array

Parameters

$value : mixed

The value to set.

$tcaFieldConf : array

Field configuration from TCA

Return values

array

checkValueForPassword()

Evaluate "password" type values.

protected checkValueForPassword(string $value, array $tcaFieldConf, string $table, int|string $id, int $realPid[, array $incomingFieldArray = [] ]) : array

Parameters

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

Table name

$id : int|string

UID of record - might be a NEW.. string for new records

$realPid : int

The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.

$incomingFieldArray : array = []

the fields being explicitly set by the outside (unlike $fieldArray) for the record

Return values

array —

$res The result array. The processed value (if any!) is set in the "value" key.

checkValueForRadio()

Evaluates 'radio' type values.

protected checkValueForRadio(array $res, string $value, array $tcaFieldConf, string $table, int $id, int $pid, string $field) : array

Parameters

$res : array

The result array. The processed value (if any!) is set in the 'value' key.

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

The table of the record

$id : int

The id of the record

$pid : int

The pid of the record

$field : string

The field to check

Return values

array —

Modified $res array

checkValueForSlug()

Evaluate "slug" type values.

protected checkValueForSlug(string $value, array $tcaFieldConf, string $table, int $id, int $realPid, string $field[, array $incomingFieldArray = [] ]) : array

Parameters

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

Table name

$id : int

UID of record

$realPid : int

The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.

$field : string

Field name

$incomingFieldArray : array = []

the fields being explicitly set by the outside (unlike $fieldArray) for the record

Tags

see
SlugHelper

Return values

array —

$res The result array. The processed value (if any!) is set in the "value" key.

checkValueForText()

Evaluate "text" type values.

protected checkValueForText(string|null $value, array $tcaFieldConf, string $table, int $realPid, string $field) : array

Parameters

$value : string|null

The value to set.

$tcaFieldConf : array

Field configuration from TCA

$table : string

Table name

$realPid : int

The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.

$field : string

Field name

Return values

array —

$res The result array. The processed value (if any!) is set in the "value" key.

checkValueForUuid()

Evaluate "uuid" type values. Will create a new uuid in case an invalid uuid is provided and the field is marked as required.

protected checkValueForUuid(string $value, array $tcaFieldConf) : array

Parameters

$value : string

The value to set.

$tcaFieldConf : array

Field configuration from TCA

Return values

array —

$res The result array. The processed value (if any!) is set in the "value" key.

controlActiveElements()

Controls active elements and sets NULL values if not active.

protected controlActiveElements() : void

Datamap is modified accordant to submitted control values.

copy_remapTranslationSourceField()

Remap languageSource field to uids of newly created records

protected copy_remapTranslationSourceField(string $table, array $l10nRecords, array $languageSourceMap) : void

Parameters

$table : string

Table name

$l10nRecords : array

array of localized records from the page we're copying from (source records)

$languageSourceMap : array

array mapping source records uids to newly copied uids

copyL10nOverlayRecords()

Find l10n-overlay records and perform the requested copy action for these records.

protected copyL10nOverlayRecords(string $table, int $uid, int $destPid[, bool $first = false ][, array $overrideValues = [] ][, string $excludeFields = '' ]) : void

Parameters

$table : string
$uid : int

uid default language record

$destPid : int

Position to copy to

$first : bool = false
$overrideValues : array = []
$excludeFields : string = ''

copyRecord_processManyToMany()

Processes the children of an MM relation field (select, group, inline) when the parent record is copied.

protected copyRecord_processManyToMany(string $table, int $uid, string $field, string $value, array $conf, int $language) : string

Parameters

$table : string
$uid : int
$field : string
$value : string
$conf : array
$language : int

Return values

string

copyRecord_processRelation()

Processes relations in an inline (IRRE) or file element when the parent record is copied.

protected copyRecord_processRelation(string $table, int $uid, string $field, string $value, array $row, array $conf, int $realDestPid, int $language, array $workspaceOptions) : string

Parameters

$table : string
$uid : int
$field : string
$value : string
$row : array
$conf : array
$realDestPid : int
$language : int
$workspaceOptions : array

Return values

string

deleteRecord_procFields()

Before a record is deleted, check if it has references such as inline type or MM references.

protected deleteRecord_procFields(string $table, array $recordToDelete[, bool $forceHardDelete = false ]) : void

If so, set these child records also to be deleted.

Parameters

$table : string
$recordToDelete : array
$forceHardDelete : bool = false

deleteSpecificPage()

Delete a page (or set deleted field to 1) and all records on it.

protected deleteSpecificPage(array $recordToDelete, bool $forceHardDelete) : void

Parameters

$recordToDelete : array
$forceHardDelete : bool

If TRUE, the "deleted" flag is ignored if applicable for record and the record is deleted COMPLETELY!

discard()

Discard a versioned record from this workspace. This deletes records from the database - no soft delete.

protected discard(string $table, int|null $uid[, array|null $record = null ]) : void

This main entry method is called recursive for sub pages, localizations, relations and records on a page. The method checks user access and gathers facts about this record to hand the deletion over to detail methods.

The incoming $uid or $row can be anything: The workspace of current user is respected and only records of current user workspace are discarded. If giving a live record uid, the versioned overly will be fetched.

Parameters

$table : string

Database table name

$uid : int|null

Uid of live or versioned record to be discarded, or null if $record is given

$record : array|null = null

Record row that should be discarded. Used instead of $uid within recursion.

discardCsvReferencesToRecord()

When the to-discard record is the target of a CSV group field of another table record, these records need to be updated to no longer point to the discarded record.

protected discardCsvReferencesToRecord(string $table, array $record) : void

Those referencing records are not very easy to find with only the to-discard record being available. The solution used here looks up records referencing the to-discard record by fetching a list of references from sys_refindex, where the to-discard record is on the right side (ref_* fields) and in the workspace the to-discard record lives in. The referencing record fields are then updated to drop the to-discard record from the CSV list.

Using sys_refindex for this task is a bit risky: This would fail if a DataHandler call adds a reference to the record and requests discarding the record in one call - the refindex is always only updated at the very end of a DataHandler call, the logic below wouldn't catch this since it would be based on an outdated sys_refindex. The scenario however is of little use and not used in core, so it should be fine.

Parameters

$table : string

Table name of this record

$record : array

The record row to handle

discardLocalizationOverlayRecords()

Find localization overlays of a record and discard them.

protected discardLocalizationOverlayRecords(string $table, array $record) : void

Parameters

$table : string

Table of this record

$record : array

Record row

discardLocalizedWorkspaceVersionsOfRecord()

When deleting a live element with sys_language_uid = 0, there may be translated records that have been created in workspaces only (t3ver_state=1). Those have to be discarded explicitly since the other 'delete' related code does not consider this case, otherwise the 'new' workspace translation would be dangling when the live record is gone.

protected discardLocalizedWorkspaceVersionsOfRecord(string $table, int $uid) : void

Parameters

$table : string
$uid : int

discardMmRelations()

When a workspace record row is discarded that has mm relations, existing mm table rows need to be deleted. The method performs the delete operation depending on TCA field configuration.

protected discardMmRelations(string $table, array $fieldConfig, array $record) : void

Parameters

$table : string

Table name of this record

$fieldConfig : array

TCA configuration of this field

$record : array

The full record of a left- or ride-side relation

discardRecordRelations()

Discard record relations like inline and MM of a record.

protected discardRecordRelations(string $table, array $record) : void

Parameters

$table : string

Table name of this record

$record : array

The record row to handle

discardSubPagesAndRecordsOnPage()

Also discard any sub pages and records of a new parent page if this page is discarded.

protected discardSubPagesAndRecordsOnPage(array $page) : void

Discarding only in specific localization, if needed.

Parameters

$page : array

Page record row

discardWorkspaceVersionsOfRecord()

Discard workspace overlays of a live record: When a live row is deleted, all existing workspace overlays are discarded.

protected discardWorkspaceVersionsOfRecord(string $table, int $uid) : void

Parameters

$table : string

Table name

$uid : int

Record UID

doesRecordExist_pageLookUp()

Unused. Removed in TYPO3 v14.

protected doesRecordExist_pageLookUp(int $uid, int $perms) : array|false

Parameters

$uid : int

Page uid

$perms : int

Permission integer

Return values

array|false

fixCopyAfterDuplFields()

When a record is copied you can specify fields from the previous record which should be copied into the new one

protected fixCopyAfterDuplFields(string $table, int $prevUid) : array

Parameters

$table : string

Table name

$prevUid : int

UID of previous record

Return values

array —

Output array (For when the copying operation needs to get the information instead of updating the info)

fixUniqueInSite()

Checks if any uniqueInSite eval fields are in the record and if so, they are re-written to be correct.

protected fixUniqueInSite(string $table, int|array $uidOrRow) : bool

Parameters

$table : string
$uidOrRow : int|array

Return values

bool —

whether the record had to be fixed or not

fixUniqueInSiteForSubpages()

Check if there are subpages that need an adoption as well

protected fixUniqueInSiteForSubpages(int $pageId) : void

Parameters

$pageId : int

formatLogDetails()

Replaces a string with placeholders (%s or {myPlaceholder}) with its substitutes.

protected formatLogDetails(string $detailString, mixed $substitutes) : string

Parameters

$detailString : string
$substitutes : mixed

Return values

string

formatLogDetailsStatic()

Static version for ViewHelpers etc.

protected static formatLogDetailsStatic(string $detailString, array $substitutes) : string

Replaces a string with placeholders (%s or {myPlaceholder}) with its substitutes.

Parameters

$detailString : string
$substitutes : array

Return values

string

getAllowedTablesToCopyWhenCopyingAPage()

Compile a list of tables that should be copied along when a page is about to be copied.

protected getAllowedTablesToCopyWhenCopyingAPage() : array

First, get the list that the user is allowed to modify (all if admin), and then check against a possible limitation within "DataHandler->copyWhichTables" if not set to "*" to limit the list further down

Return values

array

getCommandMapElements()

Gets elements of the command map that match a particular command.

protected getCommandMapElements(string $needle) : array

Parameters

$needle : string

The command to be matched

Return values

array

getDefaultLanguagePageId()

Find out if the record is a localization. If so, get the uid of the default language page.

protected getDefaultLanguagePageId(int $pageId) : int

Always returns the uid of the workspace live record: No explicit workspace overlay is applied.

Parameters

$pageId : int

Page UID, can be the default page record, or a page translation record ID

Return values

int —

UID of the default page record in live workspace

getOriginalParentOfRecord()

Gets UID of parent record. If record is deleted it will be looked up in an array built before the record was deleted

protected getOriginalParentOfRecord(string $table, int $uid) : int[]

Parameters

$table : string

Table where record lives/lived

$uid : int

Record UID

Return values

int[] —

Parent UIDs

getOuterMostInstance()

Gets the outer most instance of \TYPO3\CMS\Core\DataHandling\DataHandler Since \TYPO3\CMS\Core\DataHandling\DataHandler can create nested objects of itself, this method helps to determine the first (= outer most) one.

protected getOuterMostInstance() : DataHandler

Return values

DataHandler

getPreviousLocalizedRecordUid()

Returning uid of "previous" localized record, if any, for tables with a "sortby" column.

protected getPreviousLocalizedRecordUid(string $table, int $uid, int $pid, int $targetLanguage) : int

Used when records are localized, so that localized records are sorted in the same order as the source language records.

The uid of the returned record is later used to create the localized record "after" (higher sorting value) than the one the uid is returned of.

There are basically two scenarios:

  • The localized record is to be placed as the first record of the target pid/language combination. In this case, there is no "before" record in this language. The method returns input $uid, saying "insert the localized record with a higher sorting value than the record the localization is created from".
  • There is a localized record "before" (lower sorting value) in the target pid/language combination. For instance because source language element 2 is being translated and source language element 1 has already been translated. In this case, the uid of the 'element 1' is returned, saying "insert the localized record with a higher sorting value than the "before" record in this language.

The algorithm first fetches the record of given input uid. It then looks if there is a record with a lower sorting value for this pid/language combination. If no, input uid is returned ("place with higher sorting than source language record"). If yes, it looks if there is a localization of that source record in the target language and return the uid of that target language record ("place with higher sorting that this traget language record"). When dealing with table tt_content, colpos is also taken into account.

Parameters

$table : string

Table name

$uid : int

Uid of source language record

$pid : int

Pid of source language record

$targetLanguage : int

Target language id

Return values

int —

uid of record after which the localized record should be inserted

getSiteLanguageForPage()

Find a site language by the given language ID for a specific page, and check for all available sites if the page ID is "0".

protected getSiteLanguageForPage(int $pageId, int $languageId) : SiteLanguage|null

Note: Currently, the first language matching the given id is used, while there might be more languages with the same id in additional sites.

Parameters

$pageId : int
$languageId : int

Return values

SiteLanguage|null

getSortNumber()

Returning sorting number for tables with a "sortby" column Using when new records are created and existing records are moved around.

protected getSortNumber(string $table, int $uid, int $pid) : int|array|false

The strategy is:

  • if no record exists: set interval as sorting number
  • if inserted before an element: put in the middle of the existing elements
  • if inserted behind the last element: add interval to last sorting number
  • if collision: move all subsequent records by 2 * interval, insert new record with collision + interval

How to calculate the maximum possible inserts for the worst case of adding all records to the top, such that the sorting number stays within INT_MAX

i = interval (currently 256) c = number of inserts until collision s = max sorting number to reach (INT_MAX - 32bit) n = number of records (~83 million)

c = 2 * g g = log2(i) / 2 + 1 n = g * s / i - g + 1

The algorithm can be tuned by adjusting the interval value. Higher value means less collisions, but also less inserts are possible to stay within INT_MAX.

Parameters

$table : string
$uid : int

Uid of record to find sorting number for. May be zero in case of new.

$pid : int

Positioning PID, either >=0 (pointing to page in which case we find sorting number for first record in page) or <0 (pointing to record in which case to find next sorting number after this record)

Return values

int|array|false —

Returns integer if PID is >=0, otherwise an array with PID and sorting number. Possibly FALSE in case of error.

getSubPagesOfPage()

Checks if a whole branch of pages exists.

protected getSubPagesOfPage(int $defaultLanguagePid[, bool $useDeletedRestriction = true ]) : array<string, mixed>[]

Tests the branch under $pid. It doesn't test the page with $pid as uid.

Parameters

$defaultLanguagePid : int

uid of a default language page record

$useDeletedRestriction : bool = true

Return values

array<string, mixed>[] —

List of subpage records in branch, empty array if there are none

getUniqueCountStatement()

Gets the count of records for a unique field

protected getUniqueCountStatement(string $value, string $table, string $field, int $uid, int $pid) : QueryBuilder

Parameters

$value : string

The string value which should be unique

$table : string

Table name

$field : string

Field name for which $value must be unique

$uid : int

UID to filter out in the lookup (the record itself...)

$pid : int

If set, the value will be unique for this PID

Return values

QueryBuilder —

Return the prepared statement to check uniqueness

hardDeleteSingleRecord()

Simple helper method to hard delete one row from table ignoring delete TCA field

protected hardDeleteSingleRecord(string $table, int $uid) : void

Parameters

$table : string

A row from this table should be deleted

$uid : int

Uid of row to be deleted

hasPermissionToInsert()

Checks if user may insert a record from $table on $pid

protected hasPermissionToInsert(mixed $table, int $pid, array $pageRecord[, int $language = 0 ]) : bool

Parameters

$table : mixed
$pid : int

Integer PID

$pageRecord : array
$language : int = 0

Return values

bool

increaseSortingOfFollowingRecords()

Increases sorting field value of all records with sorting higher than $sortingValue

protected increaseSortingOfFollowingRecords(string $table, int $pid[, int|null $sortingValue = null ]) : void

Used internally by getSortNumber() to "make space" in sorting values when inserting new record

Parameters

$table : string

Table name

$pid : int

Page Uid in which to resort records

$sortingValue : int|null = null

All sorting numbers larger than this number will be shifted

initializeSlugFieldsToEmptyString()

New records capable of handling slugs (TCA type 'slug'), always require the field value to be set, in order to run through the validation process to create a new slug. Fields having `null` as value are ignored and can be used to by-pass implicit slug initialization.

protected initializeSlugFieldsToEmptyString(string $tableName, array $fieldValues) : array

Parameters

$tableName : string
$fieldValues : array

Return values

array

initializeUuidFieldsToEmptyString()

New records having uuid (TCA type 'uuid') fields defined as required need to be set, in order to run through the validation process to create a new uuid.

protected initializeUuidFieldsToEmptyString(string $tableName, array $fieldValues) : array

Parameters

$tableName : string
$fieldValues : array

Return values

array

inlineLocalizeSynchronize()

Performs localization or synchronization of child records.

protected inlineLocalizeSynchronize(string $table, int $id, array $command) : void

The $command argument expects an array, but supports a string for backward-compatibility.

$command = array( 'field' => 'tx_myfieldname', 'language' => 2, // either the key 'action' or 'ids' must be set 'action' => 'synchronize', // or 'localize' 'ids' => array(1, 2, 3, 4) // child element ids );

Parameters

$table : string

The table of the localized parent record

$id : int

The uid of the localized parent record

$command : array

Defines the command to be performed (see example above)

isElementToBeDeleted()

Determines whether an element was registered to be deleted in the registry.

protected isElementToBeDeleted(string $table, int $id) : bool

Parameters

$table : string

Name of the table

$id : int

Uid of the record

Tags

see
registerElementsToBeDeleted
see
resetElementsToBeDeleted
see
copyRecord_raw
see
versionizeRecord

Return values

bool

isNestedElementCallRegistered()

Determines nested element calls.

protected isNestedElementCallRegistered(string $table, int $id, string $identifier) : bool

Parameters

$table : string

Name of the table

$id : int

Uid of the record

$identifier : string

Name of the action to be checked

Return values

bool

isRecordLocalized()

Returns true if a localization of a record exists.

protected isRecordLocalized(string $table, int $uid, int $language) : bool

Parameters

$table : string
$uid : int
$language : int

Return values

bool

isSubmittedValueEqualToStoredValue()

Determines whether submitted values and stored values are equal.

protected isSubmittedValueEqualToStoredValue(mixed $submittedValue, mixed $storedValue, string $storedType[, bool $allowNull = false ]) : bool

This prevents from adding superfluous field changes which would be shown in the record history as well. For NULL fields (see accordant TCA definition 'nullable'), a special handling is required since (!strcmp(NULL, '')) would be a false-positive.

Parameters

$submittedValue : mixed

Value that has submitted (e.g. from a backend form)

$storedValue : mixed

Value that is currently stored in the database

$storedType : string

SQL type of the stored value column (see mysql_field_type(), e.g 'int', 'string', ...)

$allowNull : bool = false

Whether NULL values are allowed by accordant TCA definition ('nullable')

Return values

bool —

Whether both values are considered to be equal

isTableAllowedForThisPage()

Checks if a table is allowed on a certain page id according to allowed tables set for the page "doktype" and its [ctrl][rootLevel]-settings if any.

protected isTableAllowedForThisPage(int $pageUid, string $table, array $pageRecord) : bool

Parameters

$pageUid : int

Page id for which to check, including 0 (zero) if checking for page tree root.

$table : string

Table name to check

$pageRecord : array

Return values

bool —

TRUE if OK

isTableAllowedForThisPageObsolete()

Unused. Removed in TYPO3 v14.

protected isTableAllowedForThisPageObsolete(int $pageUid, string $checkTable) : bool

Parameters

$pageUid : int

Page id for which to check, including 0 (zero) if checking for page tree root.

$checkTable : string

Table name to check

Return values

bool —

TRUE if OK

overlayAutoVersionId()

Overlays the automatically versionized id of a record.

protected overlayAutoVersionId(string $table, int $id) : int

Parameters

$table : string

Name of the table

$id : int

Uid of the record

Return values

int

pageInfo()

Unused. Removed in TYPO3 v14.

protected pageInfo(int $id, string $field) : int|string|null

Parameters

$id : int

Page uid

$field : string

Field name for which to return value

Return values

int|string|null

postProcessDatabaseInsert()

Entry point to post process a database insert. Currently bails early unless a UID has been forced and the database platform is not MySQL.

protected postProcessDatabaseInsert(Connection $connection, string $tableName, int $suggestedUid) : int

Parameters

$connection : Connection
$tableName : string
$suggestedUid : int

Return values

int

postProcessPostgresqlInsert()

PostgreSQL works with sequences for auto increment columns. A sequence is not updated when a value is written to such a column. To avoid clashes when the sequence returns an existing ID this helper will update the sequence to the current max value of the column.

protected postProcessPostgresqlInsert(Connection $connection, string $tableName) : void

Parameters

$connection : Connection
$tableName : string

prepareCacheFlush()

Prepare the cache clearing

protected prepareCacheFlush(string $table, int $uid, int $pid) : array

Parameters

$table : string

Table name of record that needs to be cleared

$uid : int

UID of record for which the cache needs to be cleared

$pid : int

Original pid of the page of the record which the cache needs to be cleared

Return values

array —

Array with tagsToClear and clearCacheCommands

prependLabel()

Return "copy" label for a table. Although the name is "prepend" it actually APPENDs the label (after ...)

protected prependLabel(string $table) : string

Parameters

$table : string

Table name

Return values

string —

Label to append, containing "%s" for the number

processClearCacheQueue()

Do the actual clear cache

protected processClearCacheQueue() : void

registerElementsToBeDeleted()

Registers elements to be deleted in the registry.

protected registerElementsToBeDeleted() : void

Tags

see
process_datamap

registerNestedElementCall()

Registers nested elements calls.

protected registerNestedElementCall(string $table, int $id, string $identifier) : void

This is used to track nested calls (e.g. for following m:n relations).

Parameters

$table : string

Name of the table

$id : int

Uid of the record

$identifier : string

Name of the action to be tracked

resetElementsToBeDeleted()

Resets the elements to be deleted in the registry.

protected resetElementsToBeDeleted() : void

Tags

see
process_datamap

resetNestedElementCalls()

Resets the nested element calls.

protected resetNestedElementCalls() : void

resolveFieldConfigurationAndRespectColumnsOverrides()

Use columns overrides for evaluation.

protected resolveFieldConfigurationAndRespectColumnsOverrides(string $table, string $field) : array

Fetch the TCA ["config"] part for a specific field, including the columnsOverrides value. Used for checkValue purposes currently (as it takes the checkValue_currentRecord value).

Parameters

$table : string
$field : string

Return values

array

resolveSortingAndPidForNewRecord()

Sets the "sorting" DB field and the "pid" field of an incoming record that should be added (NEW1234) depending on the record that should be added or where it should be added.

protected resolveSortingAndPidForNewRecord(string $table, int $pid, array $fieldArray) : array

This method is called from process_datamap()

Parameters

$table : string

the table name of the record to insert

$pid : int

the real PID (numeric) where the record should be

$fieldArray : array

field+value pairs to add

Return values

array —

the modified field array

resolveVersionedRecords()

Resolves versioned records for the current workspace scope.

protected resolveVersionedRecords(string $tableName, string $fieldNames, string $sortingField, array $liveIds) : array

Delete placeholders are substituted and removed.

Parameters

$tableName : string

Name of the table to be processed

$fieldNames : string

List of the field names to be fetched

$sortingField : string

Name of the sorting field to be used

$liveIds : array

Flat array of (live) record ids

Return values

array

setNullValues()

Sets NULL values in haystack array.

protected setNullValues(array $active, array &$haystack) : void

The general behaviour in the user interface is to enable/activate fields. Thus, this method uses NULL as value to be stored if a field is not active.

Parameters

$active : array

hierarchical array with active elements

$haystack : array

hierarchical array with haystack to be modified

softOrHardDeleteSingleRecord()

Straight db based record deletion: Either set deleted = 1 for soft-delete enabled tables, or remove row from table.

protected softOrHardDeleteSingleRecord(string $table, int $uid) : void

Parameters

$table : string
$uid : int

undeleteRecord()

Restore live records by setting soft-delete flag to 0.

protected undeleteRecord(string $table, int $uid) : void

Usually only used by ext:recycler. Connected relations (eg. inline) are restored, too. Additional existing localizations are not restored.

Parameters

$table : string

Record table name

$uid : int

Record uid

undeleteRecordRelations()

Check if a to-restore record has inline references and restore them.

protected undeleteRecordRelations(string $table, int $uid, array $record) : void

Parameters

$table : string

Record table name

$uid : int

Record uid

$record : array

Record row

Tags

todo:

Add functional test undelete coverage to verify details, some details seem to be missing.

unserializeLogData()

Useful for handling old serialized data, which might have been migrated to JSON encoded properties already.

protected unserializeLogData(mixed $logData) : array|null

Parameters

$logData : mixed

Return values

array|null

unsetElementsToBeDeleted()

Unsets elements (e.g. of the data map) that shall be deleted.

protected unsetElementsToBeDeleted(array $elements) : array

This avoids to modify records that will be deleted later on.

Parameters

$elements : array

Elements to be modified

Return values

array

updateFlexFormData()

Updates FlexForm data.

protected updateFlexFormData(string $flexFormId, array $modifications) : void

Parameters

$flexFormId : string

e.g.

::

$modifications : array

Modifications with paths and values (e.g. 'sDEF/lDEV/field/vDEF' => 'TYPO3')

validateValueForRequired()

Checks if required=true is set: if set: checks if the value is not empty (or not "0").

protected validateValueForRequired(array $tcaFieldConfig, mixed $value) : bool

if not set: does not matter, always returns true:

Parameters

$tcaFieldConfig : array
$value : mixed

Tags

todo:

If this requirement is not fulfilled, DataHandler should not execute any write statements, which could be properly covered by tests then

Return values

bool —

true if the required flag is set and the value is properly set, or if the required flag is not needed (and thus always valid).

workspaceAllowAutoCreation()

Evaluates if auto creation of a version of a record is allowed.

protected workspaceAllowAutoCreation(string $table, int $id, int|null $recpid) : bool

Auto-creation of version: In offline workspace, test if versioning is enabled and look for workspace version of input record. If there is no versionized record found we will create one and save to that.

Parameters

$table : string

Table of the record

$id : int

UID of record

$recpid : int|null

PID of record

Return values

bool —

TRUE if ok.

On this page