Methods summary
protected
array
|
#
getFilteredFieldNames( array $exclude )
Gets the field names exluding the given ones.
Gets the field names exluding the given ones.
Parameters
- $exclude
- the field names to exclude
Returns
array all field names excluding the given ones
|
protected
mixed
|
#
getFieldValue( string $name, string $key )
Gets the value of a field key.
Gets the value of a field key.
Parameters
- $name
- the name of the field
- $key
- the value of the key
Returns
mixed the value of the field key or null if not existing
|
protected
|
#
setFieldValue( string $name, string $key, mixed $value )
Sets the value of a field key. If the field or the key in the field
don't exist, they get created.
Sets the value of a field key. If the field or the key in the field
don't exist, they get created.
Parameters
- $name
- the name of the field
- $key
- the value of the key
- $value
- the new value
|
protected
string
|
#
getReferenceValue( string $fieldName, string $key )
Gets the value of a reference field.
Gets the value of a reference field.
Parameters
- $fieldName
- the field name of the reference
- $key
- the key of the reference value
Returns
string the value of the reference field
|
protected
boolean
|
#
isConstraint( string $fieldName, string $constraint )
Checks if the given field has the given constraint.
Checks if the given field has the given constraint.
Parameters
- $fieldName
- the field name maybe having the constraint
- $constraint
- the constraint to check, 'required' or 'unique'
Returns
boolean true if the given field has the given constraint
|
public
|
#
__construct( string $table, array $fields, string $label, array $localeLabels, array $standardFieldLabels, CRUDlex\CRUDServiceProvider $serviceProvider )
Constructor.
Parameters
- $table
- the table of the entity
- $fields
- the fieldstructure just like the CRUD YAML
- $label
- the label of the entity
- $localeLabels
- the labels of the entity in the locales
- $standardFieldLabels
- labels for the fields "id", "created_at" and "updated_at"
- $serviceProvider
- The current service provider
|
public
array
|
#
getFieldNames( )
Gets all field names, including the implicit ones like "id" or
"created_at".
Gets all field names, including the implicit ones like "id" or
"created_at".
Returns
array the field names
|
public
|
#
setListFields( array $listFields )
Sets the field names to be used in the listview.
Sets the field names to be used in the listview.
Parameters
- $listFields
- the field names to be used in the listview
|
public
array
|
#
getListFields( )
Gets the field names to be used in the listview. If they were not specified,
all public field names are returned.
Gets the field names to be used in the listview. If they were not specified,
all public field names are returned.
Returns
array the field names to be used in the listview
|
public
array
|
#
getChildrenLabelFields( )
Gets the fields used to display the children on the details page of an
entity. The keys are the entity names as in the CRUD YAML and the values
are the field names.
Gets the fields used to display the children on the details page of an
entity. The keys are the entity names as in the CRUD YAML and the values
are the field names.
Returns
array the fields used to display the children on the details page
|
public
|
#
setChildrenLabelFields( array $childrenLabelFields )
Sets the fields used to display the children on the details page of an
entity. The keys are the entity names as in the CRUD YAML and the values
are the field names.
Sets the fields used to display the children on the details page of an
entity. The keys are the entity names as in the CRUD YAML and the values
are the field names.
Parameters
- $childrenLabelFields
- the fields used to display the children on the details page
|
public
boolean
|
#
isDeleteCascade( )
Gets whether to delete its children when an instance is deleted.
Gets whether to delete its children when an instance is deleted.
Returns
boolean true if so
|
public
|
#
setDeleteCascade( boolean $deleteCascade )
Sets whether to delete its children when an instance is deleted.
Sets whether to delete its children when an instance is deleted.
Parameters
- $deleteCascade
- whether to delete its children when an instance is deleted
|
public
integer
|
#
getPageSize( )
Gets the amount of items to display per page on the listview.
Gets the amount of items to display per page on the listview.
Returns
integer the amount of items to display per page on the listview
|
public
|
#
setPageSize( integer $pageSize )
Sets the amount of items to display per page on the listview.
Sets the amount of items to display per page on the listview.
Parameters
- $pageSize
- the amount of items to display per page on the listview
|
public
array
|
#
getFilter( )
Gets the fields offering a filter.
Gets the fields offering a filter.
Returns
array the fields to filter
|
public
|
#
setFilter( array $filter )
Sets the fields offering a filter.
Sets the fields offering a filter.
Parameters
- $filter
- the fields to filter
|
public
CRUDlex\CRUDServiceProvider
|
#
getServiceProvider( )
Gets the service provider.
Gets the service provider.
Returns
|
public
|
#
setServiceProvider( CRUDlex\CRUDServiceProvider $serviceProvider )
Sets the service provider.
Sets the service provider.
Parameters
- $serviceProvider
- the new service provider
|
public
array
|
#
getPublicFieldNames( )
Gets the public field names. The internal fields "version" and
"deleted_at" are filtered.
Gets the public field names. The internal fields "version" and
"deleted_at" are filtered.
Returns
array the public field names
|
public
array
|
#
getEditableFieldNames( )
Gets the field names which are editable. Not editable are fields like the
id or the created_at.
Gets the field names which are editable. Not editable are fields like the
id or the created_at.
Returns
array the editable field names
|
public
array
|
#
getReadOnlyFields( )
Gets the read only field names like the id or the created_at.
Gets the read only field names like the id or the created_at.
Returns
array the read only field names
|
public
string
|
#
getType( string $fieldName )
Gets the type of a field.
Gets the type of a field.
Parameters
- $fieldName
- the field name
Returns
string the type or null on invalid field name
|
public
|
#
setType( string $fieldName, string $value )
Sets the type of a field.
Sets the type of a field.
Parameters
- $fieldName
- the field name
- $value
- the new field type
|
public
boolean
|
#
isRequired( string $fieldName )
Gets whether a field is required.
Gets whether a field is required.
Parameters
- $fieldName
- the field name
Returns
boolean true if so
|
public
|
#
setRequired( string $fieldName, boolean $value )
Sets whether a field is required.
Sets whether a field is required.
Parameters
- $fieldName
- the field name
- $value
$fieldName
the new required state
|
public
boolean
|
#
isUnique( string $fieldName )
Gets whether a field is unique.
Gets whether a field is unique.
Parameters
- $fieldName
- the field name
Returns
boolean true if so
|
public
|
#
setUnique( string $fieldName, boolean $value )
Sets whether a field is unique.
Sets whether a field is unique.
Parameters
- $fieldName
- the field name
- $value
- true if so
|
public
string
|
#
getReferenceTable( string $fieldName )
Gets the table field of a reference.
Gets the table field of a reference.
Parameters
- $fieldName
- the field name of the reference
Returns
string the table field of a reference or null on invalid field name
|
public
string
|
#
getReferenceNameField( string $fieldName )
Gets the name field of a reference.
Gets the name field of a reference.
Parameters
- $fieldName
- the field name of the reference
Returns
string the name field of a reference or null on invalid field name
|
public
string
|
#
getReferenceEntity( string $fieldName )
Gets the entity field of a reference.
Gets the entity field of a reference.
Parameters
- $fieldName
- the field name of the reference
Returns
string the entity field of a reference or null on invalid field name
|
public
string
|
#
getFilePath( string $fieldName )
Gets the file path of a field.
Gets the file path of a field.
Parameters
- $fieldName
- the field name
Returns
string the file path of a field or null on invalid field name
|
public
|
#
setFilePath( string $fieldName, string $value )
Sets the file path of a field.
Sets the file path of a field.
Parameters
- $fieldName
- the field name
- $value
- the file path of a field or null on invalid field name
|
public
string
|
#
getFixedValue( string $fieldName )
Gets the value of a fixed field.
Gets the value of a fixed field.
Parameters
- $fieldName
- the field name
Returns
string the value of a fixed field or null on invalid field name
|
public
|
#
setFixedValue( string $fieldName, string $value )
Sets the value of a fixed field.
Sets the value of a fixed field.
Parameters
- $fieldName
- the field name
- $value
- the new value for the fixed field
|
public
array
|
#
getSetItems( string $fieldName )
Gets the items of a set field.
Gets the items of a set field.
Parameters
- $fieldName
- the field name
Returns
array the items of the set field or null on invalid field name
|
public
|
#
setSetItems( string $fieldName, string $value )
Sets the items of a set field.
Sets the items of a set field.
Parameters
- $fieldName
- the field name
- $value
- the new items of the set field
|
public
array
|
#
getFloatStep( string $fieldName )
Gets the step size of a float field.
Gets the step size of a float field.
Parameters
- $fieldName
- the field name
Returns
array the step size of a float field or null on invalid field name
|
public
|
#
setFloatStep( string $fieldName, string $value )
Sets the step size of a float field.
Sets the step size of a float field.
Parameters
- $fieldName
- the field name
- $value
- the new step size of the float field
|
public
string
|
#
getFieldLabel( string $fieldName )
Gets the label of a field.
Gets the label of a field.
Parameters
- $fieldName
- the field name
Returns
string the label of the field or the field name if no label is set in the CRUD
YAML
|
public
|
#
setFieldLabel( string $fieldName, string $value )
Gets the label of a field.
Gets the label of a field.
Parameters
- $fieldName
- the field name
- $value
- the new label of the field
|
public
string
|
#
getTable( )
Gets the table where the data is stored.
Gets the table where the data is stored.
Returns
string the table where the data is stored
|
public
|
#
setTable( string $table )
Sets the table where the data is stored.
Sets the table where the data is stored.
Parameters
- $table
- the new table where the data is stored
|
public
string
|
#
getLabel( )
Gets the label for the entity.
Gets the label for the entity.
Returns
string the label for the entity
|
public
|
#
setLabel( string $label )
Sets the label for the entity.
Sets the label for the entity.
Parameters
- $label
- the new label for the entity
|
public
string
|
#
getDescription( string $fieldName )
Gets the description of a field.
Gets the description of a field.
Parameters
- $fieldName
- the field name
Returns
string the description of the field
|
public
|
#
setDescription( string $fieldName, string $value )
Sets the description of a field.
Sets the description of a field.
Parameters
- $fieldName
- the field name
- $value
- the new description of the field
|
public
|
#
addChild( string $table, string $fieldName, string $entity )
Adds a child to this definition in case the other
definition has a reference to this one.
Adds a child to this definition in case the other
definition has a reference to this one.
Parameters
- $table
- the table of the referencing definition
- $fieldName
- the field name of the referencing definition
- $entity
- the entity of the referencing definition
|
public
array
|
#
getChildren( )
Gets the referencing children to this definition.
Gets the referencing children to this definition.
Returns
array an array with the children referencing the entity. All entries are arrays
with three referencing elements: table, fieldName, entity
|
public
|
#
setLocale( string $locale )
Sets the locale to be used.
Sets the locale to be used.
Parameters
- $locale
- the locale to be used.
|
public
|
#
setInitialSortField( string $initialSortField )
Sets the initial sort field.
Sets the initial sort field.
Parameters
- $initialSortField
- the new initial sort field
|
public
string
|
#
getInitialSortField( )
Gets the initial sort field.
Gets the initial sort field.
Returns
string the initial sort field
|
public
|
#
setInitialSortAscending( boolean $initialSortAscending )
Sets the initial sort order.
Sets the initial sort order.
Parameters
- $initialSortAscending
- the initial sort order, true if ascending
|
public
boolean
|
#
getInitialSortAscending( )
Gets the initial sort order.
Gets the initial sort order.
Returns
boolean the initial sort order, true if ascending
|
Properties summary
protected
|
$table
The table where the data is stored.
The table where the data is stored.
|
|
protected
|
$fields
Holds all fields in the same structure as in the CRUD YAML file.
Holds all fields in the same structure as in the CRUD YAML file.
|
|
protected
|
$label
The label for the entity.
The label for the entity.
|
|
protected
|
$localeLabels
The labels of the entity in the locales.
The labels of the entity in the locales.
|
|
protected
|
$children
An array with the children referencing the entity. All entries are
arrays with three referencing elements: table, fieldName, entity
An array with the children referencing the entity. All entries are
arrays with three referencing elements: table, fieldName, entity
|
|
protected
|
$standardFieldLabels
Labels for the fields "id", "created_at" and "updated_at".
Labels for the fields "id", "created_at" and "updated_at".
|
|
protected
|
$listFields
An array containing the fields which should appear in the list view
of the entity.
An array containing the fields which should appear in the list view
of the entity.
|
|
protected
|
$childrenLabelFields
The fields used to display the children on the details page of an entity.
The keys are the entity names as in the CRUD YAML and the values are the
field names.
The fields used to display the children on the details page of an entity.
The keys are the entity names as in the CRUD YAML and the values are the
field names.
|
|
protected
|
$deleteCascade
Whether to delete its children when an instance is deleted.
Whether to delete its children when an instance is deleted.
|
|
protected
|
$pageSize
The amount of items to display per page on the listview.
The amount of items to display per page on the listview.
|
|
protected
|
$filter
The fields offering to be filtered.
The fields offering to be filtered.
|
|
protected
|
$serviceProvider
|
|
protected
|
$locale
|
|
protected
|
$initialSortField
Holds the initial sort field.
Holds the initial sort field.
|
|
protected
|
$initialSortAscending
Holds the initial sort order.
Holds the initial sort order.
|
|