Backend implements BackendInterface, SingletonInterface

A persistence backend. This backend maps objects to the relational model of the storage backend.

It persists all added, removed and changed objects.

Internal

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

Table of Contents

Interfaces

BackendInterface
A persistence backend interface
SingletonInterface
"empty" interface for singletons (marker interface pattern)

Properties

$aggregateRootObjects  : ObjectStorage
$changedEntities  : ObjectStorage
$configurationManager  : ConfigurationManagerInterface
$dataMapFactory  : DataMapFactory
$deletedEntities  : ObjectStorage
$eventDispatcher  : EventDispatcherInterface
$persistenceManager  : PersistenceManagerInterface
$referenceIndex  : ReferenceIndex
The TYPO3 reference index object
$reflectionService  : ReflectionService
$session  : Session
$signalSlotDispatcher  : Dispatcher
$storageBackend  : BackendInterface
$visitedDuringPersistence  : ObjectStorage

Methods

__construct()  : mixed
Constructs the backend
commit()  : mixed
Commits the current persistence session.
getIdentifierByObject()  : string|null
Returns the (internal) identifier for the object, if it is known to the backend. Otherwise NULL is returned.
getObjectByIdentifier()  : object|null
Returns the object with the (internal) identifier, if it is known to the backend. Otherwise NULL is returned.
getObjectCountByQuery()  : int
Returns the number of records matching the query.
getObjectDataByQuery()  : array<string|int, mixed>
Returns the object data matching the $query.
isNewObject()  : bool
Checks if the given object has ever been persisted.
setAggregateRootObjects()  : mixed
Sets the aggregate root objects
setChangedEntities()  : mixed
Sets the changed objects
setDeletedEntities()  : mixed
Sets the deleted objects
setPersistenceManager()  : mixed
Set a PersistenceManager instance.
addCommonDateFieldsToRow()  : mixed
Adjusts the common date fields of the given row to the current time
addCommonFieldsToRow()  : mixed
Adds common database fields to a row
attachObjectToParentObject()  : mixed
Updates the fields defining the relation between the object and the parent object.
attachObjectToParentObjectRelationHasMany()  : mixed
Updates fields defining the relation between the object and the parent object in relation has-many.
deleteAllRelationsFromRelationtable()  : bool
Delete all mm-relations of a parent from a relation table
deleteRelationFromRelationtable()  : bool
Delete an mm-relation from a relation table
detachObjectFromParentObject()  : mixed
Updates the fields defining the relation between the object and the parent object.
determineStoragePageIdForNewRecord()  : int
Determine the storage page ID for a given NEW record
getPlainValue()  : int|string|null
Returns a plain value
getRemovedChildObjects()  : array<string|int, mixed>
Returns the removed objects determined by a comparison of the clean property value with the actual property value.
getUidOfAlreadyPersistedValueObject()  : int|null
Tests, if the given Value Object already exists in the storage backend and if so, it returns the uid.
insertObject()  : mixed
Inserts an object in the storage backend
insertRelationInRelationtable()  : int
Inserts mm-relation into a relation table
persistObject()  : mixed
Persists the given object.
persistObjects()  : mixed
Traverse and persist all aggregate roots and their object graph.
persistObjectStorage()  : mixed
Persists an object storage. Objects of a 1:n or m:n relation are queued and processed with the parent object.
processDeletedObjects()  : mixed
Iterate over deleted aggregate root objects and process them
propertyValueIsLazyLoaded()  : bool
Checks, if the property value is lazy loaded and was not initialized
removeEntity()  : mixed
Deletes an object
removeRelatedObjects()  : mixed
Remove related objects
updateObject()  : bool
Updates a given object in the storage
updateRelationInRelationTable()  : bool
Updates mm-relation in a relation table
updateRelationOfObjectToParentObject()  : mixed
Updates the fields defining the relation between the object and the parent object.

Properties

$eventDispatcher

protected EventDispatcherInterface $eventDispatcher

Methods

__construct()

Constructs the backend

public __construct(ConfigurationManagerInterface $configurationManager, Session $session, ReflectionService $reflectionService, BackendInterface $storageBackend, DataMapFactory $dataMapFactory, EventDispatcherInterface $eventDispatcher) : mixed
Parameters
$configurationManager : ConfigurationManagerInterface
$session : Session
$reflectionService : ReflectionService
$storageBackend : BackendInterface
$dataMapFactory : DataMapFactory
$eventDispatcher : EventDispatcherInterface

commit()

Commits the current persistence session.

public commit() : mixed

getIdentifierByObject()

Returns the (internal) identifier for the object, if it is known to the backend. Otherwise NULL is returned.

public getIdentifierByObject(object $object) : string|null
Parameters
$object : object
Return values
string|null

The identifier for the object if it is known, or NULL

getObjectByIdentifier()

Returns the object with the (internal) identifier, if it is known to the backend. Otherwise NULL is returned.

public getObjectByIdentifier(string $identifier, string $className) : object|null
Parameters
$identifier : string
$className : string
Return values
object|null

The object for the identifier if it is known, or NULL

getObjectCountByQuery()

Returns the number of records matching the query.

public getObjectCountByQuery(QueryInterface $query) : int
Parameters
$query : QueryInterface
Return values
int

getObjectDataByQuery()

Returns the object data matching the $query.

public getObjectDataByQuery(QueryInterface $query) : array<string|int, mixed>
Parameters
$query : QueryInterface
Return values
array<string|int, mixed>

isNewObject()

Checks if the given object has ever been persisted.

public isNewObject(object $object) : bool
Parameters
$object : object

The object to check

Return values
bool

TRUE if the object is new, FALSE if the object exists in the repository

addCommonDateFieldsToRow()

Adjusts the common date fields of the given row to the current time

protected addCommonDateFieldsToRow(DomainObjectInterface $object, array<string|int, mixed> &$row) : mixed
Parameters
$object : DomainObjectInterface
$row : array<string|int, mixed>

The row to be updated

attachObjectToParentObjectRelationHasMany()

Updates fields defining the relation between the object and the parent object in relation has-many.

protected attachObjectToParentObjectRelationHasMany(DomainObjectInterface $object, DomainObjectInterface $parentObject, string $parentPropertyName[, int $sortingPosition = 0 ]) : mixed
Parameters
$object : DomainObjectInterface
$parentObject : DomainObjectInterface
$parentPropertyName : string
$sortingPosition : int = 0
Tags
throws
IllegalRelationTypeException

deleteAllRelationsFromRelationtable()

Delete all mm-relations of a parent from a relation table

protected deleteAllRelationsFromRelationtable(DomainObjectInterface $parentObject, string $parentPropertyName) : bool
Parameters
$parentObject : DomainObjectInterface

The parent object

$parentPropertyName : string

The name of the parent object's property where the related objects are stored in

Return values
bool

TRUE if delete was successfully

deleteRelationFromRelationtable()

Delete an mm-relation from a relation table

protected deleteRelationFromRelationtable(DomainObjectInterface $relatedObject, DomainObjectInterface $parentObject, string $parentPropertyName) : bool
Parameters
$relatedObject : DomainObjectInterface

The related object

$parentObject : DomainObjectInterface

The parent object

$parentPropertyName : string

The name of the parent object's property where the related objects are stored in

Return values
bool

determineStoragePageIdForNewRecord()

Determine the storage page ID for a given NEW record

protected determineStoragePageIdForNewRecord([DomainObjectInterface|null $object = null ]) : int

This does the following:

  • If the domain object has an accessible property 'pid' (i.e. through a getPid() method), that is used to store the record.
  • If there is a TypoScript configuration "classes.CLASSNAME.newRecordStoragePid", that is used to store new records.
  • If there is no such TypoScript configuration, it uses the first value of The "storagePid" taken for reading records.
Parameters
$object : DomainObjectInterface|null = null
Return values
int

the storage Page ID where the object should be stored

getPlainValue()

Returns a plain value

protected getPlainValue(mixed $input[, ColumnMap|null $columnMap = null ]) : int|string|null

i.e. objects are flattened out if possible. Checks explicitly for null values as DataMapper's getPlainValue would convert this to 'NULL'

Parameters
$input : mixed

The value that will be converted

$columnMap : ColumnMap|null = null

Optional column map for retrieving the date storage format

Return values
int|string|null

getRemovedChildObjects()

Returns the removed objects determined by a comparison of the clean property value with the actual property value.

protected getRemovedChildObjects(DomainObjectInterface $object, string $propertyName) : array<string|int, mixed>
Parameters
$object : DomainObjectInterface

The object

$propertyName : string
Return values
array<string|int, mixed>

An array of removed objects

getUidOfAlreadyPersistedValueObject()

Tests, if the given Value Object already exists in the storage backend and if so, it returns the uid.

protected getUidOfAlreadyPersistedValueObject(AbstractValueObject $object) : int|null
Parameters
$object : AbstractValueObject

The object to be tested

Return values
int|null

The matching uid if an object was found, else null

insertRelationInRelationtable()

Inserts mm-relation into a relation table

protected insertRelationInRelationtable(DomainObjectInterface $object, DomainObjectInterface $parentObject, string $propertyName[, int $sortingPosition = null ]) : int
Parameters
$object : DomainObjectInterface

The related object

$parentObject : DomainObjectInterface

The parent object

$propertyName : string

The name of the parent object's property where the related objects are stored in

$sortingPosition : int = null

Defaults to NULL

Return values
int

The uid of the inserted row

persistObjects()

Traverse and persist all aggregate roots and their object graph.

protected persistObjects() : mixed

persistObjectStorage()

Persists an object storage. Objects of a 1:n or m:n relation are queued and processed with the parent object.

protected persistObjectStorage(ObjectStorage $objectStorage, DomainObjectInterface $parentObject, string $propertyName, array<string|int, mixed> &$row) : mixed

A 1:1 relation gets persisted immediately. Objects which were removed from the property were detached from the parent object. They will not be deleted by default. You have to annotate the property with '@TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")' if you want them to be deleted as well.

Parameters
$objectStorage : ObjectStorage

The object storage to be persisted.

$parentObject : DomainObjectInterface

The parent object. One of the properties holds the object storage.

$propertyName : string

The name of the property holding the object storage.

$row : array<string|int, mixed>

The row array of the parent object to be persisted. It's passed by reference and gets filled with either a comma separated list of uids (csv) or the number of contained objects.

processDeletedObjects()

Iterate over deleted aggregate root objects and process them

protected processDeletedObjects() : mixed

propertyValueIsLazyLoaded()

Checks, if the property value is lazy loaded and was not initialized

protected propertyValueIsLazyLoaded(mixed $propertyValue) : bool
Parameters
$propertyValue : mixed

The property value

Return values
bool

removeEntity()

Deletes an object

protected removeEntity(DomainObjectInterface $object[, bool $markAsDeleted = true ]) : mixed
Parameters
$object : DomainObjectInterface

The object to be removed from the storage

$markAsDeleted : bool = true

Whether to just flag the row deleted (default) or really delete it

updateObject()

Updates a given object in the storage

protected updateObject(DomainObjectInterface $object, array<string|int, mixed> $row) : bool
Parameters
$object : DomainObjectInterface

The object to be updated

$row : array<string|int, mixed>

Row to be stored

Return values
bool

updateRelationInRelationTable()

Updates mm-relation in a relation table

protected updateRelationInRelationTable(DomainObjectInterface $object, DomainObjectInterface $parentObject, string $propertyName[, int $sortingPosition = 0 ]) : bool
Parameters
$object : DomainObjectInterface

The related object

$parentObject : DomainObjectInterface

The parent object

$propertyName : string

The name of the parent object's property where the related objects are stored in

$sortingPosition : int = 0

Defaults to NULL

Return values
bool

TRUE if update was successfully


        
On this page

Search results