PHP 클래스 CRUDlex\Entity

With this objects, the data is passed arround and validated.
파일 보기 프로젝트 열기: philiplb/crudlex 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$definition The {@see EntityDefinition} defining how this entity looks like.
$entity Holds the key value data of the entity.

공개 메소드들

메소드 설명
__construct ( EntityDefinition $definition ) Constructor.
get ( string $field ) : mixed Gets the value of a field in its specific type.
getDefinition ( ) : EntityDefinition Gets the entity definition.
getRaw ( string $field ) : mixed Gets the raw value of a field no matter what type it is.
populateViaRequest ( Request $request ) Populates the entities fields from the requests parameters.
set ( string $field, mixed $value ) Sets a field value pair of this entity.

보호된 메소드들

메소드 설명
toType ( mixed $value, string $type ) : mixed Converts a given value to the given type.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( EntityDefinition $definition )
$definition EntityDefinition the definition how this entity looks

get() 공개 메소드

Gets the value of a field in its specific type.
public get ( string $field ) : mixed
$field string the field
리턴 mixed null on invalid field, an integer if the definition says that the type of the field is an integer, a boolean if the field is a boolean or else the raw value

getDefinition() 공개 메소드

Gets the entity definition.
public getDefinition ( ) : EntityDefinition
리턴 EntityDefinition the definition

getRaw() 공개 메소드

This is usefull for input validation for example.
public getRaw ( string $field ) : mixed
$field string the field
리턴 mixed null on invalid field or else the raw value

populateViaRequest() 공개 메소드

Populates the entities fields from the requests parameters.
public populateViaRequest ( Request $request )
$request Symfony\Component\HttpFoundation\Request the request to take the field data from

set() 공개 메소드

Sets a field value pair of this entity.
public set ( string $field, mixed $value )
$field string the field
$value mixed the value

toType() 보호된 메소드

Converts a given value to the given type.
protected toType ( mixed $value, string $type ) : mixed
$value mixed the value to convert
$type string the type to convert to like 'integer' or 'float'
리턴 mixed the converted value

프로퍼티 상세

$definition 보호되어 있는 프로퍼티

The {@see EntityDefinition} defining how this entity looks like.
protected $definition

$entity 보호되어 있는 프로퍼티

Holds the key value data of the entity.
protected $entity