# Class CRUDEntity

Represents a single set of data in field value pairs like the row in a database. Depends of course on the `CRUDlex\CRUDData` implementation being used. With this objects, the data is passed arround and validated.

Namespace: CRUDlex
Located at CRUDEntity.php

Methods summary
`protected mixed` | # `toType( mixed $value, string $type )` Converts a given value to the given type. Converts a given value to the given type. #### Parameters $value the value to convert $type the type to convert to like 'int' or 'float' #### Returns mixed the converted value
`public` | # `__construct( `CRUDlex\CRUDEntityDefinition` $definition )` Constructor. Constructor. #### Parameters $definition the definition how this entity looks
`public` | # `set( string $field, mixed $value )` Sets a field value pair of this entity. Sets a field value pair of this entity. #### Parameters $field the field $value the value
`public mixed` | # `getRaw( string $field )` Gets the raw value of a field no matter what type it is. This is usefull for input validation for example. Gets the raw value of a field no matter what type it is. This is usefull for input validation for example. #### Parameters $field the field #### Returns mixed null on invalid field or else the raw value
`public mixed` | # `get( string $field )` Gets the value of a field in its specific type. Gets the value of a field in its specific type. #### Parameters $field the field #### Returns mixed null on invalid field, an int if the definition says that the type of the field is an int, a boolean if the field is a bool or else the raw value
`public `CRUDlex\CRUDEntityDefinition`` | # `getDefinition( )` Gets the entity definition. Gets the entity definition. #### Returns `CRUDlex\CRUDEntityDefinition` the definition
`public` | # `populateViaRequest( Symfony\Component\HttpFoundation\Request $request )` Populates the entities fields from the requests parameters. Populates the entities fields from the requests parameters. #### Parameters $request the request to take the field data from

Properties summary
`protected` | $definition The `CRUDlex\CRUDEntityDefinition` defining how this entity looks like. The `CRUDlex\CRUDEntityDefinition` defining how this entity looks like. | # ``
`protected` | $entity Holds the key value data of the entity. Holds the key value data of the entity. | # ``