Overview

Namespaces

  • CRUDlex

Classes

  • CRUDControllerProvider
  • CRUDData
  • CRUDEntity
  • CRUDEntityDefinition
  • CRUDMySQLData
  • CRUDMySQLDataFactory
  • CRUDServiceProvider
  • CRUDSimpleFilesystemFileProcessor

Interfaces

  • CRUDDataFactoryInterface
  • CRUDFileProcessorInterface
  • Overview
  • Namespace
  • Class

Class CRUDEntityDefinition

Namespace: CRUDlex
Located at CRUDEntityDefinition.php
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
public
# __construct( string $table, array $fields, string $label, array $listFields, array $standardFieldLabels, array $childrenLabelFields, boolean $deleteCascade, integer $pageSize, CRUDlex\CRUDServiceProvider $serviceProvider )

Constructor.

Constructor.

Parameters

$table
the table of the entity
$fields
the fieldstructure just like the CRUD YAML
$label
the label of the entity
$listFields

an array containing the fields which should appear in the list view of the entity

$standardFieldLabels
labels for the fields "id", "created_at" and "updated_at"
$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

$deleteCascade
whether to delete its children when an instance is deleted
$pageSize
the amount of items to display per page on the listview
$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 array
# getListFieldNames( )

Gets the field names to be used in the listview. If they were not specified in the constructor, all public field names are returned.

Gets the field names to be used in the listview. If they were not specified in the constructor, 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 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 CRUDlex\CRUDServiceProvider
# getServiceProvider( )

Gets the service provider.

Gets the service provider.

Returns

CRUDlex\CRUDServiceProvider
the 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 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 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 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 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 @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 @string
# getLabel( )

Gets the label for the entity.

Gets the label for the entity.

Returns

@string
the label for the entity
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

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 $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 $serviceProvider

Holds the CRUDlex\CRUDServiceProvider.

Holds the CRUDlex\CRUDServiceProvider.

#
CRUDlex API API documentation generated by ApiGen