‪TYPO3CMS  10.4
TYPO3\CMS\Core\Resource\FileRepository Class Reference
Inheritance diagram for TYPO3\CMS\Core\Resource\FileRepository:
TYPO3\CMS\Core\Resource\AbstractRepository TYPO3\CMS\Extbase\Persistence\RepositoryInterface TYPO3\CMS\Core\SingletonInterface

Public Member Functions

array findByRelation ($tableName, $fieldName, $uid)
 
FileReference bool findFileReferenceByUid ($uid)
 
File[] searchByName (Folder $folder, $fileName)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Resource\AbstractRepository
 __construct ()
 
 add ($object)
 
 remove ($object)
 
 replace ($existingObject, $newObject)
 
 update ($modifiedObject)
 
array getAddedObjects ()
 
array getRemovedObjects ()
 
array findAll ()
 
int countAll ()
 
 removeAll ()
 
object findByUid ($uid)
 
 setDefaultOrderings (array $defaultOrderings)
 
 setDefaultQuerySettings (QuerySettingsInterface $defaultQuerySettings)
 
TYPO3 CMS Extbase Persistence QueryInterface createQuery ()
 
object null findByIdentifier ($identifier)
 
 __call ($method, $arguments)
 
string getEntityClassName ()
 

Protected Member Functions

File createDomainObject (array $databaseRow)
 
 reapplySorting (array $itemList)
 
FileIndexRepository getFileIndexRepository ()
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Core\Resource\AbstractRepository
string getEnvironmentMode ()
 

Protected Attributes

string $objectType = File::class
 
string $table = 'sys_file'
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Core\Resource\AbstractRepository
string $table = ''
 
ResourceFactory $factory
 
string $typeField = ''
 
string $type = ''
 
string $objectType
 

Detailed Description

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

Definition at line 32 of file FileRepository.php.

Member Function Documentation

◆ createDomainObject()

File TYPO3\CMS\Core\Resource\FileRepository::createDomainObject ( array  $databaseRow)
protected

Creates an object managed by this repository.

Parameters
array$databaseRow
Returns
File

Reimplemented from TYPO3\CMS\Core\Resource\AbstractRepository.

Definition at line 55 of file FileRepository.php.

◆ findByRelation()

array TYPO3\CMS\Core\Resource\FileRepository::findByRelation (   $tableName,
  $fieldName,
  $uid 
)

Find FileReference objects by relation to other records

Parameters
string$tableName‪Table name of the related record
string$fieldName‪Field name of the related record
int$uid‪The UID of the related record (needs to be the localized uid, as translated IRRE elements relate to them)
Returns
‪array An array of objects, empty if no objects found
Exceptions

Definition at line 69 of file FileRepository.php.

References TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger(), TYPO3\CMS\Core\Resource\AbstractRepository\getEnvironmentMode(), TYPO3\CMS\Backend\Utility\BackendUtility\getTcaFieldConfiguration(), and TYPO3\CMS\Core\Resource\FileRepository\reapplySorting().

Referenced by TYPO3\CMS\Frontend\Resource\FileCollector\getFileReferences().

◆ findFileReferenceByUid()

FileReference bool TYPO3\CMS\Core\Resource\FileRepository::findFileReferenceByUid (   $uid)

Find FileReference objects by uid

Parameters
int$uid‪The UID of the sys_file_reference record
Returns
‪FileReference|bool
Exceptions

Definition at line 145 of file FileRepository.php.

References TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger().

Referenced by TYPO3\CMS\Frontend\Resource\FileCollector\addFileReferences().

◆ getFileIndexRepository()

FileIndexRepository TYPO3\CMS\Core\Resource\FileRepository::getFileIndexRepository ( )
protected

Return a file index repository

Returns
‪FileIndexRepository

Definition at line 204 of file FileRepository.php.

References TYPO3\CMS\Core\Resource\Index\FileIndexRepository\getInstance().

◆ reapplySorting()

TYPO3\CMS\Core\Resource\FileRepository::reapplySorting ( array  $itemList)
protected

As sorting might have changed due to workspace overlays, PHP does the sorting again.

Parameters
array$itemList

Definition at line 163 of file FileRepository.php.

References TYPO3\CMS\Core\Resource\FileReference\getReferenceProperty().

Referenced by TYPO3\CMS\Core\Resource\FileRepository\findByRelation().

◆ searchByName()

File [] TYPO3\CMS\Core\Resource\FileRepository::searchByName ( Folder  $folder,
  $fileName 
)

Search for files by name in a given folder

Parameters
Folder$folder
string$fileName
Returns
File[]
Deprecated:
‪Use ResourceStorage::searchFiles instead

Definition at line 190 of file FileRepository.php.

References TYPO3\CMS\Core\Resource\Search\FileSearchDemand\createForSearchTerm(), and TYPO3\CMS\Core\Resource\Folder\searchFiles().

Member Data Documentation

◆ $objectType

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

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

Definition at line 40 of file FileRepository.php.

◆ $table

string TYPO3\CMS\Core\Resource\FileRepository::$table = 'sys_file'
protected

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

Definition at line 47 of file FileRepository.php.