‪TYPO3CMS  11.5
TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend:
TYPO3\CMS\Extbase\Persistence\Generic\Storage\BackendInterface TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct (CacheService $cacheService, ReflectionService $reflectionService)
 
int addRow (string $tableName, array $fieldValues, bool $isRelation=false)
 
 updateRow (string $tableName, array $fieldValues, bool $isRelation=false)
 
 updateRelationTableRow (string $tableName, array $fieldValues)
 
 removeRow (string $tableName, array $where, bool $isRelation=false)
 
array getObjectDataByQuery (QueryInterface $query)
 
int getObjectCountByQuery (QueryInterface $query)
 
int null getUidOfAlreadyPersistedValueObject (AbstractValueObject $object)
 

Protected Member Functions

array getObjectDataByRawQuery (Statement $statement)
 
array overlayLanguageAndWorkspace (SourceInterface $source, array $rows, QueryInterface $query, int $workspaceUid=null)
 
 overlayLanguageAndWorkspaceForSelect (string $tableName, array $rows, PageRepository $pageRepository, QueryInterface $query)
 
 overlayLanguageAndWorkspaceForJoinedSelect (string $tableName, array $rows, PageRepository $pageRepository, QueryInterface $query)
 
array int mixed null overlayLanguageAndWorkspaceForSingleRecord (string $tableName, array $row, PageRepository $pageRepository, QueryInterface $query)
 
 resolveMovedRecordsInWorkspace (string $tableName, array $rows, int $workspaceUid)
 

Protected Attributes

ConnectionPool $connectionPool
 
ReflectionService $reflectionService
 
CacheService $cacheService
 

Detailed Description

A Storage backend

only to be used within Extbase, not part of TYPO3 Core API.

Definition at line 55 of file Typo3DbBackend.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::__construct ( CacheService  $cacheService,
ReflectionService  $reflectionService 
)

Member Function Documentation

◆ addRow()

int TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::addRow ( string  $tableName,
array  $fieldValues,
bool  $isRelation = false 
)

Adds a row to the storage

Parameters
string$tableName‪The database table name
array$fieldValues‪The row to be inserted
bool$isRelation‪TRUE if we are currently inserting into a relation table, FALSE by default
Returns
‪int The uid of the inserted row
Exceptions
SqlErrorException

Implements TYPO3\CMS\Extbase\Persistence\Generic\Storage\BackendInterface.

Definition at line 77 of file Typo3DbBackend.php.

◆ getObjectCountByQuery()

int TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::getObjectCountByQuery ( QueryInterface  $query)

◆ getObjectDataByQuery()

◆ getObjectDataByRawQuery()

array TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::getObjectDataByRawQuery ( Statement  $statement)
protected

Returns the object data using a custom statement

Parameters
Qom\Statement$statement
Returns
‪array
Exceptions
SqlErrorException‪when the raw SQL statement fails in the database

Definition at line 267 of file Typo3DbBackend.php.

References TYPO3\CMS\Core\Database\ConnectionPool\DEFAULT_CONNECTION_NAME, TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement\getBoundVariables(), and TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement\getStatement().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\getObjectDataByQuery().

◆ getUidOfAlreadyPersistedValueObject()

int null TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::getUidOfAlreadyPersistedValueObject ( AbstractValueObject  $object)

Checks if a Value Object equal to the given Object exists in the database

Parameters
AbstractValueObject$object‪The Value Object
Returns
‪int|null The matching uid if an object was found, else FALSE
Exceptions
SqlErrorException

Implements TYPO3\CMS\Extbase\Persistence\Generic\Storage\BackendInterface.

Definition at line 369 of file Typo3DbBackend.php.

References $GLOBALS, TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject\_getProperty(), and TYPO3\CMS\Core\Http\ApplicationType\fromRequest().

◆ overlayLanguageAndWorkspace()

array TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::overlayLanguageAndWorkspace ( SourceInterface  $source,
array  $rows,
QueryInterface  $query,
int  $workspaceUid = null 
)
protected

Performs workspace and language overlay on the given row array. The language and workspace id is automatically detected (depending on FE or BE context). You can also explicitly set the language/workspace id.

Parameters
Qom\SourceInterface$source‪The source (selector or join)
array$rows
QueryInterface$query
int | null$workspaceUid
Returns
‪array
Exceptions

Definition at line 426 of file Typo3DbBackend.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspaceForJoinedSelect(), TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspaceForSelect(), and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\resolveMovedRecordsInWorkspace().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\getObjectDataByQuery().

◆ overlayLanguageAndWorkspaceForJoinedSelect()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::overlayLanguageAndWorkspaceForJoinedSelect ( string  $tableName,
array  $rows,
PageRepository  $pageRepository,
QueryInterface  $query 
)
protected

If the result consists of a JOIN (usually happens if a property is a relation with a MM table) then it is necessary to only do overlays for the fields that are contained in the main database table, otherwise a SQL error is thrown. In order to make this happen, a single SQL query is made to fetch all possible field names (= array keys) of a record (TCA[$tableName][columns] does not contain all needed information), which is then used to compute a separate subset of the row which can be overlaid properly.

Definition at line 481 of file Typo3DbBackend.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\getRawRecord(), and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspaceForSingleRecord().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspace().

◆ overlayLanguageAndWorkspaceForSelect()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::overlayLanguageAndWorkspaceForSelect ( string  $tableName,
array  $rows,
PageRepository  $pageRepository,
QueryInterface  $query 
)
protected

If the result is a plain SELECT (no JOIN) then the regular overlay process works for tables

  • ‪overlay workspace
  • ‪overlay language of versioned record again

Definition at line 462 of file Typo3DbBackend.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspaceForSingleRecord().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspace().

◆ overlayLanguageAndWorkspaceForSingleRecord()

array int mixed null TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::overlayLanguageAndWorkspaceForSingleRecord ( string  $tableName,
array  $row,
PageRepository  $pageRepository,
QueryInterface  $query 
)
protected

◆ removeRow()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::removeRow ( string  $tableName,
array  $where,
bool  $isRelation = false 
)

Deletes a row in the storage

Parameters
string$tableName‪The database table name
array$where‪An array of where array('fieldname' => value).
bool$isRelation‪TRUE if we are currently manipulating a relation table, FALSE by default
Exceptions
SqlErrorException

Implements TYPO3\CMS\Extbase\Persistence\Generic\Storage\BackendInterface.

Definition at line 198 of file Typo3DbBackend.php.

◆ resolveMovedRecordsInWorkspace()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::resolveMovedRecordsInWorkspace ( string  $tableName,
array  $rows,
int  $workspaceUid 
)
protected

Fetches the moved record in case it is supported by the table and if there's only one row in the result set (applying this to all rows does not work, since the sorting order would be destroyed and possible limits are not met anymore) The move pointers are later unset (see versionOL() last argument)

Definition at line 572 of file Typo3DbBackend.php.

References TYPO3\CMS\Core\Versioning\VersionState\MOVE_POINTER, and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspace().

◆ updateRelationTableRow()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::updateRelationTableRow ( string  $tableName,
array  $fieldValues 
)

Updates a relation row in the storage.

Parameters
string$tableName‪The database relation table name
array$fieldValues‪The row to be updated
Exceptions
SqlErrorException

Implements TYPO3\CMS\Extbase\Persistence\Generic\Storage\BackendInterface.

Definition at line 159 of file Typo3DbBackend.php.

◆ updateRow()

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::updateRow ( string  $tableName,
array  $fieldValues,
bool  $isRelation = false 
)

Updates a row in the storage

Parameters
string$tableName‪The database table name
array$fieldValues‪The row to be updated
bool$isRelation‪TRUE if we are currently inserting into a relation table, FALSE by default
Exceptions

Implements TYPO3\CMS\Extbase\Persistence\Generic\Storage\BackendInterface.

Definition at line 118 of file Typo3DbBackend.php.

Member Data Documentation

◆ $cacheService

CacheService TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::$cacheService
protected

◆ $connectionPool

ConnectionPool TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::$connectionPool
protected

Definition at line 57 of file Typo3DbBackend.php.

◆ $reflectionService

ReflectionService TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::$reflectionService
protected