‪TYPO3CMS  ‪main
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)
 
 getObjectDataByQuery (QueryInterface $query)
 
int getObjectCountByQuery (QueryInterface $query)
 
int null getUidOfAlreadyPersistedValueObject (AbstractValueObject $object)
 

Protected Member Functions

 getObjectDataByRawQuery (Statement $statement)
 
 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 56 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 78 of file Typo3DbBackend.php.

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

◆ getObjectCountByQuery()

◆ getObjectDataByQuery()

◆ getObjectDataByRawQuery()

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

◆ 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 346 of file Typo3DbBackend.php.

References $GLOBALS, TYPO3\CMS\Webhooks\Message\$uid, TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject\_getProperty(), TYPO3\CMS\Core\Http\fromRequest, TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject\PROPERTY_PID, and TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject\PROPERTY_UID.

◆ overlayLanguageAndWorkspace()

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)
int | null$workspaceUid
Exceptions

Definition at line 401 of file Typo3DbBackend.php.

References TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface\getLanguageAspect(), TYPO3\CMS\Extbase\Persistence\QueryInterface\getQuerySettings(), 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 456 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 437 of file Typo3DbBackend.php.

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

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

◆ overlayLanguageAndWorkspaceForSingleRecord()

◆ 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 176 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 565 of file Typo3DbBackend.php.

References 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 137 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 108 of file Typo3DbBackend.php.

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

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 58 of file Typo3DbBackend.php.

◆ $reflectionService

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