PHP Class Spot\Entity\Manager

Author: Vance Lucas ([email protected])
Exibir arquivo Open project: vlucas/spot2 Class Usage Examples

Protected Properties

Property Type Description
$entityName string | Spot\Entity
$fieldAliasMappings array
$fieldDefaultValues array
$fields array
$fieldsDefined array
$mapper
$primaryKeyField
$relations array
$scopes array
$table
$tableOptions

Public Methods

Method Description
__construct ( string | Entity $entityName ) Entity to get information for
fieldAliasMappings ( ) : array Field alias mappings (used for lookup)
fieldDefaultValues ( ) : array Get field default values as defined in class field definitions
fieldExists ( string $field ) : boolean Check if field exists in defined fields
fieldKeys ( ) : array Groups field keys into names arrays of fields with key name as index
fieldType ( string $field ) : mixed Return field type
fields ( ) : array Get formatted fields with all necessary array keys and values.
fieldsDefined ( ) : array Get field information exactly how it is defined in the class
mapper ( ) : string Get name of custom mapper for given entity class
primaryKeyField ( ) Get value of primary key for given row result
relations ( ) Get defined relations
resetFields ( )
table ( ) : string Get name of table for given entity class
tableOptions ( ) : string Get table options for given entity class

Private Methods

Method Description
computeIndexName ( string $table, string | boolean $indexConfiguration ) : string | boolean Attempt to generate a user-suffixed index name

Method Details

__construct() public method

Entity to get information for
public __construct ( string | Entity $entityName )
$entityName string | Spot\Entity

fieldAliasMappings() public method

Field alias mappings (used for lookup)
public fieldAliasMappings ( ) : array
return array Field alias => actual column name

fieldDefaultValues() public method

Get field default values as defined in class field definitions
public fieldDefaultValues ( ) : array
return array Array of field key => value pairs

fieldExists() public method

Check if field exists in defined fields
public fieldExists ( string $field ) : boolean
$field string Field name to check for existence
return boolean

fieldKeys() public method

Groups field keys into names arrays of fields with key name as index
public fieldKeys ( ) : array
return array Key-named associative array of field names in that index

fieldType() public method

Return field type
public fieldType ( string $field ) : mixed
$field string Field name
return mixed Field type string or boolean false

fields() public method

Merges defaults with defined field values to ensure all options exist for each field.
public fields ( ) : array
return array Defined fields plus all defaults for full array of all possible options

fieldsDefined() public method

Get field information exactly how it is defined in the class
public fieldsDefined ( ) : array
return array Array of field key => value pairs

mapper() public method

Get name of custom mapper for given entity class
public mapper ( ) : string
return string

primaryKeyField() public method

Get value of primary key for given row result
public primaryKeyField ( )

relations() public method

Get defined relations
public relations ( )

resetFields() public method

public resetFields ( )

table() public method

Get name of table for given entity class
public table ( ) : string
return string

tableOptions() public method

Get table options for given entity class
public tableOptions ( ) : string
return string

Property Details

$entityName protected_oe property

protected string|Entity,Spot $entityName
return string | Spot\Entity

$fieldAliasMappings protected_oe property

protected array $fieldAliasMappings
return array

$fieldDefaultValues protected_oe property

protected array $fieldDefaultValues
return array

$fields protected_oe property

protected array $fields
return array

$fieldsDefined protected_oe property

protected array $fieldsDefined
return array

$mapper protected_oe property

protected $mapper

$primaryKeyField protected_oe property

protected $primaryKeyField

$relations protected_oe property

protected array $relations
return array

$scopes protected_oe property

protected array $scopes
return array

$table protected_oe property

protected $table

$tableOptions protected_oe property

protected $tableOptions