Convert DAO value for HTML display
Do NOT use if PHP is multi threaded
package | salt\converter |
---|---|
inherited_from | \salt\AbstractConverter |
__get(string $field) : mixed
string
Field name
mixed
converter value__set(string $field, mixed $value)
string
Field name
mixed
Value
column(\salt\Base $object, \salt\Field $field, mixed $value, string $format, array<mixed,mixed> $params) : string
\salt\Base
The singleton object
\salt\Field
the field to display
mixed
the default value
string
format to use for change the output
array<mixed,mixed>
others parameters passed to convert function
string
HTML escaped text for describe $field in $formatconvert(mixed $value) : mixed
convert(mixed $value) : mixed
convertAs(\salt\Base $otherObject, mixed $value, string $method = NULL
) : mixed
\salt\Base
An instance of the other object (retrieve it with ::singleton())
mixed
The value to convert
string
Optional, override the method to use for convert, one of DAOConverter::METHOD_*
mixed
the converted valueconvertForSetter(mixed $value) : mixed
convertForSetter(mixed $value) : mixed
edit(\salt\Base $object, \salt\Field $field, mixed $value, string $format, array<mixed,mixed> $params) : string
\salt\Base
object that contains the value
\salt\Field
the field
mixed
the value to edit
string
format to use
array<mixed,mixed>
others parameters passed to convert function
string
a full HTML form tag (input, select, etc...) for editing the valuegetContext() : mixed
mixed
$context The contextgetField() : string
string
the field namegetInstance(object|string $object= NULL
, mixed $context= NULL
, string $fieldName= NULL
) : static
object
string
Object or class name for static call
mixed
context to pass at convert method
string
set field name : use it when delegate calls between DAOConverters only.
static
the converter instancegetObject() : object | string
object
string
$object Instance of class name of the objectgetValue(string $field) : mixed | NULL
getValue(string $field) : mixed | NULL
string
field name
mixed
NULL
the field value on current object or NULL if there is no current objectsetter(\salt\Field $field, mixed $value) : mixed
\salt\Field
field
mixed
the value to convert
mixed
the converted valuesetterDB(\salt\Field $field, mixed $value, string $format) : mixed
\salt\Field
field
mixed
the value to convert
string
the format to use
mixed
the converted valuesetterInput(\salt\Base $object, \salt\Field $field, mixed $value, string $format, array<mixed,mixed> $params) : mixed
\salt\Base
object that contains the value
\salt\Field
field
mixed
the value to convert
string
the format of the value
array<mixed,mixed>
others parameters passed to convert function
mixed
the converted valueshow(\salt\Base $object, \salt\Field $field, mixed $value, string $format, array<mixed,mixed> $params) : string
\salt\Base
object that contains the value
\salt\Field
the field
mixed
the value to display
string
format to use
array<mixed,mixed>
others parameters passed to convert function
string
an HTML escaped valuesql(\salt\Base $object, \salt\Field $field, mixed $value, string $format, array<mixed,mixed> $params) : mixed
This method DO NOT make any SQL escape. With PDO or similar, we don't need escape
\salt\Base
object that contains the value
\salt\Field
field
mixed
the value to convert
string
the format of the value
array<mixed,mixed>
others parameters passed to convert function
mixed
the value for using in SQL querytext(\salt\Base $object, \salt\Field $field, mixed $value, string $format, array<mixed,mixed> $params) : string
\salt\Base
object that contains the value
\salt\Field
the field
mixed
the value to display
string
format to use
array<mixed,mixed>
others parameters passed to convert function
string
a non-HTML escaped value_init(array<mixed,mixed> $context= NULL
, object $object= NULL
, string $field= NULL
)
array<mixed,mixed>
an array with format entry
object
the object
string
the field name
convertFromExternal(string $field, mixed $value, string $format) : mixed
A value for a boolean field is converted to boolean. A value for a date field is converted to timestamp.
string
Field name
mixed
value to convert
string
date format
mixed
the converted valueconvertNullValues(\salt\Field $field, mixed $value, string $format) : NULL | string
Any nullable field with an empty string value will be NULL. If we want a real empty string, we have to use Field::EMPTY_STRING instead
\salt\Field
the field
mixed
the value
string
the format from convert function
NULL
string
the converted value__construct()
delegateTo(mixed $value, array<mixed,string> $validMethods) : mixed
mixed
value to convert
array<mixed,string>
valid methods
mixed
the converted value$_salt_context : array<mixed,mixed>
NULL
$_salt_field : string
NULL
$_salt_instances : array<mixed,\salt\Converter>
array()
$_salt_object : object
NULL
METHOD_COLUMN = 'column'
METHOD_EDIT = 'edit'
METHOD_SET = 'setterInput'
METHOD_SHOW = 'show'
METHOD_SQL = 'sql'
METHOD_TEXT = 'text'