RecordFactory
Creates record objects out of TCA-based database rows by evaluating the TCA columns and splitting everything which is not a declared column for a TCA type. This is usually the case when a TCA table has a 'typeField' defined, such as "pages", "be_users" and "tt_content".
In addition, the RecordFactory can create "Resolved records" by utilizing the RecordFieldTransformer. A "Resolved record" is checked for the actual type (TCA field column type) and is then resolved to
- a relation (records, files or folders - wrapped in collections)
- an exploded list (e.g. static select)
- a FlexForm field
- a DateTime field.
This means that the field value of a "Resolved Record" is expanded to the actual types (Date objects etc.)
not part of TYPO3 Core API yet.
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Properties
- $eventDispatcher : EventDispatcherInterface
- $fieldTransformer : RecordFieldTransformer
- $schemaFactory : TcaSchemaFactory
Methods
- __construct() : mixed
- createFromDatabaseRow() : RecordInterface
- Takes a full database record (the whole row), and creates a Record object out of it, based on the type of the record.
- createRawRecord() : RawRecord
- Creates a raw record object from a table and a record array.
- createResolvedRecordFromDatabaseRow() : RecordInterface
- Create a "resolved" record. Resolved means that the fields will have their values resolved and extended. A typical use-case is resolving of related records, or using \DateTimeImmutable objects for datetime fields.
- createRecord() : RecordInterface
- Quick helper function in order to avoid duplicate code.
- extractComputedProperties() : ComputedProperties
- extractSystemInformation() : array<string|int, mixed>
Properties
$eventDispatcher
protected
EventDispatcherInterface
$eventDispatcher
$fieldTransformer
protected
RecordFieldTransformer
$fieldTransformer
$schemaFactory
protected
TcaSchemaFactory
$schemaFactory
Methods
__construct()
public
__construct(TcaSchemaFactory $schemaFactory, RecordFieldTransformer $fieldTransformer, EventDispatcherInterface $eventDispatcher) : mixed
Parameters
- $schemaFactory : TcaSchemaFactory
- $fieldTransformer : RecordFieldTransformer
- $eventDispatcher : EventDispatcherInterface
createFromDatabaseRow()
Takes a full database record (the whole row), and creates a Record object out of it, based on the type of the record.
public
createFromDatabaseRow(string $table, array<string|int, mixed> $record) : RecordInterface
This method does not handle special expansion of fields.
Parameters
- $table : string
- $record : array<string|int, mixed>
Tags
Return values
RecordInterfacecreateRawRecord()
Creates a raw record object from a table and a record array.
public
createRawRecord(string $table, array<string|int, mixed> $record) : RawRecord
Parameters
- $table : string
- $record : array<string|int, mixed>
Return values
RawRecordcreateResolvedRecordFromDatabaseRow()
Create a "resolved" record. Resolved means that the fields will have their values resolved and extended. A typical use-case is resolving of related records, or using \DateTimeImmutable objects for datetime fields.
public
createResolvedRecordFromDatabaseRow(string $table, array<string|int, mixed> $record[, Context|null $context = null ][, RecordIdentityMap|null $recordIdentityMap = null ]) : RecordInterface
Parameters
- $table : string
- $record : array<string|int, mixed>
- $context : Context|null = null
- $recordIdentityMap : RecordIdentityMap|null = null
Return values
RecordInterfacecreateRecord()
Quick helper function in order to avoid duplicate code.
protected
createRecord(RawRecord $rawRecord, array<string|int, mixed> $properties[, Context|null $context = null ]) : RecordInterface
Parameters
Return values
RecordInterfaceextractComputedProperties()
protected
extractComputedProperties(array<string|int, mixed> &$record) : ComputedProperties
Parameters
- $record : array<string|int, mixed>
Return values
ComputedPropertiesextractSystemInformation()
protected
extractSystemInformation(TcaSchema $schema, RawRecord $rawRecord, array<string|int, mixed> $properties) : array<string|int, mixed>