ProcessedFileRepository implements LoggerAwareInterface, SingletonInterface uses LoggerAwareTrait

A repository for accessing and storing processed files.

This class is mainly meant to be used internally in TYPO3 for accessing via FileProcessingService or custom FAL Processors.

Table of Contents

Interfaces

LoggerAwareInterface
SingletonInterface
"empty" interface for singletons (marker interface pattern)

Properties

$factory  : ResourceFactory
$tableColumns  : array<string|int, mixed>
As determining the table columns is a costly operation this is done only once during runtime and cached afterward.
$taskTypeRegistry  : TaskTypeRegistry

Methods

__construct()  : mixed
add()  : void
Adds a processed file object to the database.
countByStorage()  : int
Count processed files by storage. This is used in the "Install Tool" to render statistics of processed files.
findAllByOriginalFile()  : array<string|int, ProcessedFile>
findByStorageAndIdentifier()  : ProcessedFile|null
findByUid()  : ProcessedFile
Finds a processed file matching the given UID.
findOneByOriginalFileAndTaskTypeAndConfiguration()  : ProcessedFile
removeAll()  : int
Removes all processed files and also deletes the associated physical files.
update()  : void
Updates an existing file object in the database. If the file has not been persisted yet, nothing changes.
cleanUnavailableColumns()  : array<string|int, mixed>
Removes all array keys which cannot be persisted.
createDomainObject()  : ProcessedFile
createNewProcessedFileObject()  : ProcessedFile
Creates a ProcessedFile object from a file object and a processing configuration.
prepareTaskObject()  : TaskInterface
We need a task object, so the task can define what configuration is necessary. This way, we can then use a cleaned up configuration to find already processed files.

Properties

$tableColumns

As determining the table columns is a costly operation this is done only once during runtime and cached afterward.

protected array<string|int, mixed> $tableColumns = []
Tags
see
cleanUnavailableColumns()

Methods

countByStorage()

Count processed files by storage. This is used in the "Install Tool" to render statistics of processed files.

public countByStorage(ResourceStorage $storage) : int
Parameters
$storage : ResourceStorage
Return values
int

findOneByOriginalFileAndTaskTypeAndConfiguration()

public findOneByOriginalFileAndTaskTypeAndConfiguration(File $file, string $taskType, array<string|int, mixed> $configuration) : ProcessedFile
Parameters
$file : File
$taskType : string

The task that should be executed on the file

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

removeAll()

Removes all processed files and also deletes the associated physical files.

public removeAll([int|null $storageUid = null ]) : int

If a storageUid is given, only db entries and files of this storage are removed.

Parameters
$storageUid : int|null = null

If not NULL, only the processed files of the given storage are removed

Return values
int

Number of failed deletions

update()

Updates an existing file object in the database. If the file has not been persisted yet, nothing changes.

public update(ProcessedFile $processedFile) : void
Parameters
$processedFile : ProcessedFile

cleanUnavailableColumns()

Removes all array keys which cannot be persisted.

protected cleanUnavailableColumns(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>
Return values
array<string|int, mixed>

createDomainObject()

protected createDomainObject(array<string|int, mixed> $databaseRow) : ProcessedFile
Parameters
$databaseRow : array<string|int, mixed>
Return values
ProcessedFile

createNewProcessedFileObject()

Creates a ProcessedFile object from a file object and a processing configuration.

protected createNewProcessedFileObject(FileInterface $originalFile, string $taskType, array<string|int, mixed> $configuration) : ProcessedFile
Parameters
$originalFile : FileInterface
$taskType : string
$configuration : array<string|int, mixed>
Return values
ProcessedFile

prepareTaskObject()

We need a task object, so the task can define what configuration is necessary. This way, we can then use a cleaned up configuration to find already processed files.

protected prepareTaskObject(FileInterface $fileObject, string $taskType, array<string|int, mixed> $configuration) : TaskInterface

The method sanitizeConfiguration should then be part of the TaskInterface later-on.

Note: The Task object needs to be re-created with a real processed file, once we have one, as the current API Design is very tightly coupled:

  • TaskInterface has a constructor in the interface (which is bad)
  • TaskObject requires a constituted ProcessedFile object in order to "work"
  • ProcessedFile creates a TaskObject in ProcessedFile->getTask()
  • ProcessedFile AND TaskObject contain both the configuration, which should be avoided as well.
Parameters
$fileObject : FileInterface
$taskType : string
$configuration : array<string|int, mixed>
Tags
todo:

This should be shifted into a TaskFactory or the TaskRegistry

Return values
TaskInterface

        
On this page

Search results