ContextInterface
                
            in
            
        
    
        
            Interface for FormHelper context implementations.
Table of Contents
Constants
- VALID_ATTRIBUTES = ['length', 'precision', 'comment', 'null', 'default']
 
Methods
- attributes() : array<string|int, mixed>
 - Get an associative array of other attributes for a field name.
 - error() : array<string|int, mixed>
 - Get the errors for a given field
 - fieldNames() : array<string|int, string>
 - Get the field names of the top level object in this context.
 - getMaxLength() : int|null
 - Get maximum length of a field from model validation.
 - getPrimaryKey() : array<string|int, string>
 - Get the fields used in the context as a primary key.
 - getRequiredMessage() : string|null
 - Gets the default "required" error message for a field
 - hasError() : bool
 - Check whether a field has an error attached to it
 - isCreate() : bool
 - Returns whether this form is for a create operation.
 - isPrimaryKey() : bool
 - Returns true if the passed field name is part of the primary key for this context
 - isRequired() : bool|null
 - Check if a given field is 'required'.
 - type() : string|null
 - Get the abstract field type for a given field name.
 - val() : mixed
 - Get the current value for a given field.
 
Constants
VALID_ATTRIBUTES
    public
        array<string|int, string>
    VALID_ATTRIBUTES
    = ['length', 'precision', 'comment', 'null', 'default']
    
    
    
    
Methods
attributes()
Get an associative array of other attributes for a field name.
    public
                    attributes(string $field) : array<string|int, mixed>
    Parameters
- $field : string
 - 
                    
A dot separated path to get additional data on.
 
Return values
array<string|int, mixed> —An array of data describing the additional attributes on a field.
error()
Get the errors for a given field
    public
                    error(string $field) : array<string|int, mixed>
    Parameters
- $field : string
 - 
                    
A dot separated path to check errors on.
 
Return values
array<string|int, mixed> —An array of errors, an empty array will be returned when the context has no errors.
fieldNames()
Get the field names of the top level object in this context.
    public
                    fieldNames() : array<string|int, string>
    Return values
array<string|int, string> —A list of the field names in the context.
getMaxLength()
Get maximum length of a field from model validation.
    public
                    getMaxLength(string $field) : int|null
    Parameters
- $field : string
 - 
                    
Field name.
 
Return values
int|nullgetPrimaryKey()
Get the fields used in the context as a primary key.
    public
                    getPrimaryKey() : array<string|int, string>
    Return values
array<string|int, string>getRequiredMessage()
Gets the default "required" error message for a field
    public
                    getRequiredMessage(string $field) : string|null
    Parameters
- $field : string
 - 
                    
A dot separated path to the field name
 
Return values
string|nullhasError()
Check whether a field has an error attached to it
    public
                    hasError(string $field) : bool
    Parameters
- $field : string
 - 
                    
A dot separated path to check errors on.
 
Return values
bool —Returns true if the errors for the field are not empty.
isCreate()
Returns whether this form is for a create operation.
    public
                    isCreate() : bool
    Return values
boolisPrimaryKey()
Returns true if the passed field name is part of the primary key for this context
    public
                    isPrimaryKey(string $field) : bool
    Parameters
- $field : string
 - 
                    
A dot separated path to the field a value is needed for.
 
Return values
boolisRequired()
Check if a given field is 'required'.
    public
                    isRequired(string $field) : bool|null
    In this context class, this is simply defined by the 'required' array.
Parameters
- $field : string
 - 
                    
A dot separated path to check required-ness for.
 
Return values
bool|nulltype()
Get the abstract field type for a given field name.
    public
                    type(string $field) : string|null
    Parameters
- $field : string
 - 
                    
A dot separated path to get a schema type for.
 
Tags
Return values
string|null —An abstract data type or null.
val()
Get the current value for a given field.
    public
                    val(string $field[, array<string, mixed> $options = [] ]) : mixed
    Classes implementing this method can optionally have a second argument
$options. Valid key for $options array are:
- 
default: Default value to return if no value found in data or context record. - 
schemaDefault: Boolean indicating whether default value from context's schema should be used if it's not explicitly provided. 
Parameters
- $field : string
 - 
                    
A dot separated path to the field a value
 - $options : array<string, mixed> = []
 - 
                    
Options. is needed for.