com\setasign\Konquadrat\Field

File

File: /Konquadrat/src/Field/File.php

Class hierarchy

Implements

Summary

Constants

ALLOW_NULL_VALUE

protected const AbstractField::ALLOW_NULL_VALUE = true

Properties

$directorySettings

$dirty

protected bool AbstractField::$dirty = false

If this flag is true it couldn't correctly be loaded from the database.

$externalFileFieldDirectories

$fieldConfig

$fieldContainer

$inSave

protected bool File::$inSave = false

This flag is true if the AbstractObject is in the save() process.

$languageManager

$messageList

$temporaryFileContent

protected ?string File::$temporaryFileContent

$value

protected mixed AbstractField::$value

The field value


Static Methods

ensureDataDirectory()

public static File::ensureDataDirectory (
\com\setasign\Konquadrat\DirectorySettings $directorySettings,
?int $date = null
): void

Ensures the data directory exist

Parameters
$directorySettings : \com\setasign\Konquadrat\DirectorySettings
 
$date : ?int
 
Exceptions

Throws \com\setasign\Konquadrat\Exception

getClassNameByType()

public static AbstractField::getClassNameByType (
string $type
): string

Get the matching field class name for $type.

Parameters
$type : string
 

Methods

__construct()

public File::__construct (
\com\setasign\SetaFramework\Application\ApplicationConfig $applicationConfig,
\com\setasign\Konquadrat\DirectorySettings $directorySettings,
\com\setasign\Konquadrat\LanguageManager $languageManager,
\com\setasign\Konquadrat\Object\MessageList $messageList,
FieldContainer\FieldContainerInterface $fieldContainer,
string $name,
array $fieldConfig
)

File constructor.

Parameters
$applicationConfig : \com\setasign\SetaFramework\Application\ApplicationConfig
 
$directorySettings : \com\setasign\Konquadrat\DirectorySettings
 
$languageManager : \com\setasign\Konquadrat\LanguageManager
 
$messageList : \com\setasign\Konquadrat\Object\MessageList
 
$fieldContainer : FieldContainer\FieldContainerInterface
 
$name : string
 
$fieldConfig : array
 
Exceptions

Throws \com\setasign\Konquadrat\Exception

__clone()

public AbstractField::__clone (
void
): void
Exceptions

Throws \com\setasign\Konquadrat\Exception

__sleep()

public AbstractField::__sleep (
void
): void

callGetMethod()

public File::callGetMethod (
callable $getMethod
): mixed

Wrapper method to ensure the correct value type

Parameters
$getMethod : callable
 

getDefaultValue()

public AbstractField::getDefaultValue (
void
): ?mixed

Gets the default value

getFieldConfig()

public AbstractField::getFieldConfig (
void
): array

getFile()

public File::getFile (
void
): ?\com\setasign\SetaFramework\FileSystem\File

getLabel()

public AbstractField::getLabel (
void
): string

getName()

public AbstractField::getName (
void
): string

Return the name

getValue()

public AbstractField::getValue (
void
): ?mixed

Get the value

isDirty()

public AbstractField::isDirty (
void
): bool

Checks whether the field could correctly be loaded from the database.

parseValue()

protected File::parseValue (
mixed $value
): string

Parse the value to the correct type

Parameters
$value : mixed
 
Exceptions

Throws \JsonException

resolve()

public File::resolve (
void
): mixed

setContentType()

public File::setContentType (
string $contentType
): void
Parameters
$contentType : string
 
Exceptions

Throws \com\setasign\Konquadrat\Exception

setExternalFile()

public File::setExternalFile (
string $externalPath
): string
Parameters
$externalPath : string

Example: '/setasite-downloads/success.txt'

setFile()

public File::setFile (
string $fileName,
string $mimeType,
null|string|resource|\Psr\Http\Message\StreamInterface $fileContent,
bool $instantSave = false,
?string $filePath = null
): string

Set file. Will generate the name of the file in kon2 data directory.

Parameters
$fileName : string
 
$mimeType : string
 
$fileContent : null|string|resource|\Psr\Http\Message\StreamInterface

Note: resources will not be closed nor rewinded (before and after)!

$instantSave : bool

If true the file will be saved instant

$filePath : ?string
 
Return Values

The file path of the new file, if instantSave is false will not exist until the next save of the object.

Exceptions

Throws \com\setasign\Konquadrat\Exception

setFileByFileObject()

public File::setFileByFileObject (
\com\setasign\SetaFramework\FileSystem\File $file,
bool $instantSave = false,
?string $filePath = null
): string

Will set the file by a file object. If the object is an instance of SavedFile it will share the exact same file!

Parameters
$file : \com\setasign\SetaFramework\FileSystem\File
 
$instantSave : bool

Will be ignored if $file is a SavedFile

$filePath : ?string

Will only be used if the file is an UnsavedFile.

Return Values

The file path of the new file, if instantSave is false and $file is not a SavedFile the file will not exist until the next save of the object.

Exceptions

Throws \com\setasign\Konquadrat\Exception

setFilename()

public File::setFilename (
string $filename
): void
Parameters
$filename : string
 
Exceptions

Throws \com\setasign\Konquadrat\Exception

setValue()

public AbstractField::setValue (
mixed|DefaultValue $value
): void

Set the value

Parameters
$value : mixed|DefaultValue