# 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 )` Constructor. Constructor. #### Parameters $table the table of the entity $fields the fieldstructure just like the CRUD YAML $label the label of the entity $listFields <p>an array containing the fields which should appear in the list view of the entity</p> $standardFieldLabels labels for the fields "id", "created_at" and "updated_at" $childrenLabelFields <p>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</p>
`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 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 <p>$fieldName the new required state</p>
`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 mixed` | $table The table where the data is stored. The table where the data is stored. | # ``
`protected mixed` | $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 mixed` | $label The label for the entity. The label for the entity. | # ``
`protected mixed` | $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 mixed` | $standardFieldLabels Labels for the fields "id", "created_at" and "updated_at". Labels for the fields "id", "created_at" and "updated_at". | # ``
`protected mixed` | $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 mixed` | $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. | # ``