ProcessedFileRepository

class \TYPO3\CMS\Core\Resource\ProcessedFileRepository

Extends
AbstractRepository
Implements
LoggerAwareInterface
Uses
LoggerAwareTrait

Repository for accessing files it also serves as the public API for the indexing part of files in general

Table of Contents

Interfaces

LoggerAwareInterface

Properties

$factory  : ResourceFactory
$objectType  : string
The main object type of this class. In some cases (fileReference) this repository can also return FileReference objects, implementing the common FileInterface.
$table  : string
Main File object storage table. Note that this repository also works on the sys_file_reference table when returning FileReference objects.
$tableColumns  : array
As determining the table columns is a costly operation this is done only once during runtime and cached then
$type  : string
$typeField  : string

Methods

__call()  : mixed
Magic call method for repository methods.
__construct()  : mixed
Creates this object.
add()  : mixed
Adds a processedfile object in the database
countAll()  : int
Returns the total number objects of this repository.
countByStorage()  : int
Count processed files by storage. This is used in the install tool to render statistics of processed files.
createNewProcessedFileObject()  : ProcessedFile
Creates a ProcessedFile object from a file object and a processing configuration
createQuery()  : QueryInterface
Returns a query for objects of this repository
findAll()  : array
Returns all objects of this repository.
findAllByOriginalFile()  : ProcessedFile[]
findByIdentifier()  : object
Finds an object matching the given identifier.
findByStorageAndIdentifier()  : ProcessedFile|null
findByUid()  : object
Finds an object matching the given identifier.
findOneByOriginalFileAndTaskTypeAndConfiguration()  : ProcessedFile
getAddedObjects()  : array
Returns all objects of this repository add()ed but not yet persisted to the storage layer.
getEntityClassName()  : string
Returns the object type this repository is managing.
getRemovedObjects()  : array
Returns an array with objects remove()d from the repository that had been persisted to the storage layer before.
remove()  : mixed
Removes an object from this repository.
removeAll()  : int
Removes all processed files and also deletes the associated physical files.
replace()  : mixed
Replaces an object by another.
setDefaultOrderings()  : mixed
Sets the property names to order the result by per default.
setDefaultQuerySettings()  : mixed
Sets the default query settings to be used in this repository
update()  : mixed
Updates an existing file object in the database
cleanUnavailableColumns()  : array
Removes all array keys which cannot be persisted
createDomainObject()  : ProcessedFile
Creates an object managed by this repository.
getEnvironmentMode()  : string
Function to return the current application type based on $GLOBALS['TSFE'].

Properties

$objectType

The main object type of this class. In some cases (fileReference) this repository can also return FileReference objects, implementing the common FileInterface.

protected string $objectType = \TYPO3\CMS\Core\Resource\ProcessedFile::class

$table

Main File object storage table. Note that this repository also works on the sys_file_reference table when returning FileReference objects.

protected string $table = 'sys_file_processedfile'

$tableColumns

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

protected array $tableColumns = []

Tags

see
cleanUnavailableColumns()

$typeField

protected string $typeField = ''

Methods

__call()

Magic call method for repository methods.

public __call(string $method, array $arguments) : mixed

Parameters

$method : string

Name of the method

$arguments : array

The arguments

Tags

throws
BadMethodCallException

__construct()

Creates this object.

public __construct() : mixed

countAll()

Returns the total number objects of this repository.

public countAll() : int

Return values

int —

The object count

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

createNewProcessedFileObject()

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

public createNewProcessedFileObject(FileInterface $originalFile, string $taskType, array $configuration) : ProcessedFile

Parameters

$originalFile : FileInterface
$taskType : string
$configuration : array

Return values

ProcessedFile

findAll()

Returns all objects of this repository.

public findAll() : array

Tags

phpstan-return

iterable<T>

Return values

array —

An array of objects, empty if no objects found

findByIdentifier()

Finds an object matching the given identifier.

public findByIdentifier(mixed $identifier) : object

Parameters

$identifier : mixed

The identifier of the object to find

Tags

throws
RuntimeException
throws
InvalidArgumentException
phpstan-return

T

Return values

object —

The matching object if found

findByUid()

Finds an object matching the given identifier.

public findByUid(int $uid) : object

Parameters

$uid : int

The identifier of the object to find

Tags

throws
RuntimeException
throws
InvalidArgumentException
phpstan-return

T

Return values

object —

The matching object

findOneByOriginalFileAndTaskTypeAndConfiguration()

public findOneByOriginalFileAndTaskTypeAndConfiguration(File $file, string $taskType, array $configuration) : ProcessedFile

Parameters

$file : File
$taskType : string

The task that should be executed on the file

$configuration : array

Return values

ProcessedFile

getAddedObjects()

Returns all objects of this repository add()ed but not yet persisted to the storage layer.

public getAddedObjects() : array

Tags

phpstan-return

T[]

Return values

array —

An array of objects

getEntityClassName()

Returns the object type this repository is managing.

public getEntityClassName() : string

Return values

string

getRemovedObjects()

Returns an array with objects remove()d from the repository that had been persisted to the storage layer before.

public getRemovedObjects() : array

Tags

phpstan-return

T[]

Return values

array

remove()

Removes an object from this repository.

public remove(object $object) : mixed

Parameters

$object : object

The object to remove

Tags

phpstan-param

T $object

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

replace()

Replaces an object by another.

public replace(object $existingObject, object $newObject) : mixed

Parameters

$existingObject : object

The existing object

$newObject : object

The new object

Tags

phpstan-param

T $existingObject

phpstan-param

T $newObject

setDefaultOrderings()

Sets the property names to order the result by per default.

public setDefaultOrderings(array $defaultOrderings) : mixed

Expected like this: array( 'foo' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING )

Parameters

$defaultOrderings : array

The property names to order by

Tags

throws
BadMethodCallException

setDefaultQuerySettings()

Sets the default query settings to be used in this repository

public setDefaultQuerySettings(QuerySettingsInterface $defaultQuerySettings) : mixed

Parameters

$defaultQuerySettings : QuerySettingsInterface

The query settings to be used by default

Tags

throws
BadMethodCallException

cleanUnavailableColumns()

Removes all array keys which cannot be persisted

protected cleanUnavailableColumns(array $data) : array

Parameters

$data : array

Return values

array

createDomainObject()

Creates an object managed by this repository.

protected createDomainObject(array $databaseRow) : ProcessedFile

Parameters

$databaseRow : array

Return values

ProcessedFile

getEnvironmentMode()

Function to return the current application type based on $GLOBALS['TSFE'].

protected getEnvironmentMode() : string

This function can be mocked in unit tests to be able to test frontend behaviour.

Return values

string
On this page