File
extends File
in package
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_system_files'
- #[TableAlias]
- 'file'
Table of Contents
Properties
- $fileExtension : string|null
- $fileName : string
- $id : int|null
- $insertDatetime : DateTime
- $path : string
- $translations : Collection<int, FileText>
Methods
- __construct() : mixed
- addTranslation() : self
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getFileExtension() : string|null
- getFileName() : string
- getFullFileName() : string
- getFullPath() : string
- getId() : int|null
- getInsertDatetime() : DateTime
- getPath() : string
- getTranslation() : FileText|null
- Translation for the given language, or null.
- getTranslations() : Collection<int, FileText>
- IMPORTANT: the setter must exist. `EntityHydrator::hydrateProperty()` fills the property only through `set<Prop>()` and silently skips a collection without a setter, so the per-language file names would not be hydrated into the front end entity at all.
- isPersisted() : bool
- removeTranslation() : self
- setFileExtension() : $this
- setFileName() : $this
- setId() : $this
- setInsertDatetime() : $this
- setPath() : $this
- setTranslations() : self
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$fileExtension
protected
string|null
$fileExtension
= null
Attributes
- #[Column]
- $name: 'file_extension'
- $type: 'string'
- $length: 50
- $nullable: true
$fileName
protected
string
$fileName
= ''
Attributes
- #[Column]
- $name: 'file_name'
- $type: 'string'
- $length: 255
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'file_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$insertDatetime
protected
DateTime
$insertDatetime
= new DateTime()
Attributes
- #[Column]
- $name: 'insert_datetime'
- $type: 'datetime'
$path
protected
string
$path
= ''
Attributes
- #[Column]
- $name: 'path'
- $type: 'string'
- $length: 255
$translations
protected
Collection<int, FileText>
$translations
Attributes
- #[CollectionOf]
- \App\UI\Front\System\Models\Entities\FileText::class
- $owned: true
- #[OneToMany]
- $targetEntity: \App\UI\Front\System\Models\Entities\FileText::class
- $mappedBy: 'parent'
- $cascade: ['persist', 'remove']
- $orphanRemoval: true
- $fetch: 'LAZY'
Methods
__construct()
public
__construct() : mixed
addTranslation()
public
addTranslation(FileText $translation) : self
Parameters
- $translation : FileText
Return values
selfcallInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
getAllTraits()
Returns all traits the class uses, including those used by parent classes and nested traits.
public
getAllTraits() : array<string, string>
Return values
array<string, string>getFileExtension()
public
getFileExtension() : string|null
Return values
string|nullgetFileName()
public
getFileName() : string
Return values
stringgetFullFileName()
public
getFullFileName() : string
Return values
stringgetFullPath()
public
getFullPath() : string
Return values
stringgetId()
public
getId() : int|null
Return values
int|nullgetInsertDatetime()
public
getInsertDatetime() : DateTime
Return values
DateTimegetPath()
public
getPath() : string
Return values
stringgetTranslation()
Translation for the given language, or null.
public
getTranslation(int $langId) : FileText|null
Parameters
- $langId : int
Return values
FileText|nullgetTranslations()
IMPORTANT: the setter must exist. `EntityHydrator::hydrateProperty()` fills the property only through `set<Prop>()` and silently skips a collection without a setter, so the per-language file names would not be hydrated into the front end entity at all.
public
getTranslations() : Collection<int, FileText>
The write path is unchanged: only the front end File maps the collection, the Api and
Admin File do not have it, so no write payload sends an empty collection and
orphanRemoval has nothing to clean up.
Return values
Collection<int, FileText>isPersisted()
public
isPersisted() : bool
Return values
boolremoveTranslation()
public
removeTranslation(FileText $translation) : self
Parameters
- $translation : FileText
Return values
selfsetFileExtension()
public
setFileExtension(string|null $fileExtension) : $this
Parameters
- $fileExtension : string|null
Return values
$thissetFileName()
public
setFileName(string $fileName) : $this
Parameters
- $fileName : string
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetInsertDatetime()
public
setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
- $insertDatetime : DateTime
Return values
$thissetPath()
public
setPath(string $path) : $this
Parameters
- $path : string
Return values
$thissetTranslations()
public
setTranslations(Collection<int, FileText>|array<int, FileText> $translations) : self
Parameters
Return values
selfgetTraitsRecursive()
Walks the trait list recursively and collects nested traits too.
private
static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
- $traits : array<string, string>