PHP Class Bolt\Storage\Entity\Builder

Afficher le fichier Open project: bolt/bolt Class Usage Examples

Protected Properties

Свойство Type Description
$class string The class to use for new instances.
$classMetadata
$fieldManager
$metadata
$transformers

Méthodes publiques

Méthode Description
__construct ( MetadataDriver $metadata, FieldManager $fieldManager ) Constructor.
create ( array | object $data, object | null $entity = null ) : object Creates a new entity object.
createFromDatabaseValues ( array $data, object | null $entity = null ) : object Performs database to PHP transforms before creating new entity.
getClassMetadata ( ) : Bolt\Storage\Mapping\ClassMetadata Gets the metadata instance.
getEntity ( object | null $entity = null ) : object Returns a new empty entity class.
getFields ( ) : array Uses either the class default or the supplied ClassMetadata to return a list of fields for this entity.
getHydratedValue ( $value, $field, null $subField = null ) : Bolt\Storage\Entity\FieldValue | boolean
refresh ( object | null $entity ) Refresh an entities values.
setClass ( string $class ) Sets the entity class that will be built.
setClassMetadata ( Bolt\Storage\Mapping\ClassMetadata $classMetadata ) Sets the metadata for the class to be built.
setTransformer ( string $fieldTypeClass, callable $handler ) Adds a transformer for a specific field type.

Method Details

__construct() public méthode

Constructor.
public __construct ( MetadataDriver $metadata, FieldManager $fieldManager )
$metadata Bolt\Storage\Mapping\MetadataDriver
$fieldManager Bolt\Storage\FieldManager

create() public méthode

Creates a new entity object.
public create ( array | object $data, object | null $entity = null ) : object
$data array | object Data to load into the entity.
$entity object | null
Résultat object $entity

createFromDatabaseValues() public méthode

Performs database to PHP transforms before creating new entity.
public createFromDatabaseValues ( array $data, object | null $entity = null ) : object
$data array
$entity object | null
Résultat object $entity

getClassMetadata() public méthode

Gets the metadata instance.
public getClassMetadata ( ) : Bolt\Storage\Mapping\ClassMetadata
Résultat Bolt\Storage\Mapping\ClassMetadata $classMetadata

getEntity() public méthode

Returns a new empty entity class.
public getEntity ( object | null $entity = null ) : object
$entity object | null
Résultat object

getFields() public méthode

Uses either the class default or the supplied ClassMetadata to return a list of fields for this entity.
public getFields ( ) : array
Résultat array

getHydratedValue() public méthode

public getHydratedValue ( $value, $field, null $subField = null ) : Bolt\Storage\Entity\FieldValue | boolean
$value
$field
$subField null
Résultat Bolt\Storage\Entity\FieldValue | boolean

refresh() public méthode

Refresh an entities values.
public refresh ( object | null $entity )
$entity object | null

setClass() public méthode

Sets the entity class that will be built.
public setClass ( string $class )
$class string

setClassMetadata() public méthode

Sets the metadata for the class to be built.
public setClassMetadata ( Bolt\Storage\Mapping\ClassMetadata $classMetadata )
$classMetadata Bolt\Storage\Mapping\ClassMetadata

setTransformer() public méthode

Adds a transformer for a specific field type.
public setTransformer ( string $fieldTypeClass, callable $handler )
$fieldTypeClass string Class of the field type to transform
$handler callable

Property Details

$class protected_oe property

The class to use for new instances.
protected string $class
Résultat string

$classMetadata protected_oe property

protected $classMetadata

$fieldManager protected_oe property

protected $fieldManager

$metadata protected_oe property

protected $metadata

$transformers protected_oe property

protected $transformers