PHP Class Bravo3\Orm\Mappers\Metadata\Entity

Mostra file Open project: bravo3/orm Class Usage Examples

Protected Properties

Property Type Description
$class_name string
$columns Column[]
$id_columns Column[]
$indices Bravo3\Orm\Mappers\Metadata\Index[]
$property_map array Used to lookup the property that matches a getter/setter function
$relationships Relationship[]
$sortables Sortable[]
$table_name string

Public Methods

Method Description
__construct ( string $class_name, string $table_name )
addColumn ( Column $column ) Add a column
addIndex ( Bravo3\Orm\Mappers\Metadata\Index $index ) Add an index
addRelationship ( Relationship $relationship ) Add a relationship
addSortable ( Sortable $sortable ) Add a sortable to the table metadata
getClassName ( ) : string Get ClassName
getColumnByProperty ( $name ) : Column | null Get a column by its property name, or null if no such column exists
getColumns ( ) : Column[] Get columns
getIdColumns ( ) : Column[] Get all columns that are marked an as an ID field
getIndexByName ( string $name ) : Bravo3\Orm\Mappers\Metadata\Index | null Get an index by its name, or null if no such index exists
getIndices ( ) : Bravo3\Orm\Mappers\Metadata\Index[] Get indices
getPropertyFor ( string $fn ) : string | null Get the name of the property matching the given function
getRelationshipByName ( string $name ) : Relationship | null Get a relationship by its name, or null if no such relationship exists
getRelationships ( ) : Relationship[] Get relationships
getSortableByName ( string $name ) : Sortable | null Get a table sortable by name
getSortables ( ) : Sortable[] Get Sortables
getTableName ( ) : string Get the entity class name
setClassName ( string $class_name ) Set the entity class name
setColumns ( array $columns ) Set columns
setIndices ( array $indices ) Set indices
setRelationships ( array $relationships ) Set relationships
setSortables ( array $sortables ) Set Sortables
setTableName ( string $table_name ) Set TableName

Private Methods

Method Description
generatePropertyMap ( ) Generate a list of all getters/setters and what property they refer to
resetMaps ( ) Clear the maps based on the columns

Method Details

__construct() public method

public __construct ( string $class_name, string $table_name )
$class_name string
$table_name string

addColumn() public method

Add a column
public addColumn ( Column $column )
$column Column

addIndex() public method

Add an index
public addIndex ( Bravo3\Orm\Mappers\Metadata\Index $index )
$index Bravo3\Orm\Mappers\Metadata\Index

addRelationship() public method

Add a relationship
public addRelationship ( Relationship $relationship )
$relationship Relationship

addSortable() public method

Add a sortable to the table metadata
public addSortable ( Sortable $sortable )
$sortable Sortable

getClassName() public method

Get ClassName
public getClassName ( ) : string
return string

getColumnByProperty() public method

Get a column by its property name, or null if no such column exists
public getColumnByProperty ( $name ) : Column | null
$name
return Column | null

getColumns() public method

Get columns
public getColumns ( ) : Column[]
return Column[]

getIdColumns() public method

Get all columns that are marked an as an ID field
public getIdColumns ( ) : Column[]
return Column[]

getIndexByName() public method

Get an index by its name, or null if no such index exists
public getIndexByName ( string $name ) : Bravo3\Orm\Mappers\Metadata\Index | null
$name string
return Bravo3\Orm\Mappers\Metadata\Index | null

getIndices() public method

Get indices
public getIndices ( ) : Bravo3\Orm\Mappers\Metadata\Index[]
return Bravo3\Orm\Mappers\Metadata\Index[]

getPropertyFor() public method

Get the name of the property matching the given function
public getPropertyFor ( string $fn ) : string | null
$fn string
return string | null

getRelationshipByName() public method

Get a relationship by its name, or null if no such relationship exists
public getRelationshipByName ( string $name ) : Relationship | null
$name string
return Relationship | null

getRelationships() public method

Get relationships
public getRelationships ( ) : Relationship[]
return Relationship[]

getSortableByName() public method

Get a table sortable by name
public getSortableByName ( string $name ) : Sortable | null
$name string
return Sortable | null

getSortables() public method

Get Sortables
public getSortables ( ) : Sortable[]
return Sortable[]

getTableName() public method

Get the entity class name
public getTableName ( ) : string
return string

setClassName() public method

Set the entity class name
public setClassName ( string $class_name )
$class_name string

setColumns() public method

Set columns
public setColumns ( array $columns )
$columns array

setIndices() public method

Set indices
public setIndices ( array $indices )
$indices array

setRelationships() public method

Set relationships
public setRelationships ( array $relationships )
$relationships array

setSortables() public method

Set Sortables
public setSortables ( array $sortables )
$sortables array

setTableName() public method

Set TableName
public setTableName ( string $table_name )
$table_name string

Property Details

$class_name protected_oe property

protected string $class_name
return string

$columns protected_oe property

protected Column[],Bravo3\Orm\Mappers\Metadata $columns
return Column[]

$id_columns protected_oe property

protected Column[],Bravo3\Orm\Mappers\Metadata $id_columns
return Column[]

$indices protected_oe property

protected Index[],Bravo3\Orm\Mappers\Metadata $indices
return Bravo3\Orm\Mappers\Metadata\Index[]

$property_map protected_oe property

Used to lookup the property that matches a getter/setter function
protected array $property_map
return array

$relationships protected_oe property

protected Relationship[],Bravo3\Orm\Mappers\Metadata $relationships
return Relationship[]

$sortables protected_oe property

protected Sortable[],Bravo3\Orm\Mappers\Metadata $sortables
return Sortable[]

$table_name protected_oe property

protected string $table_name
return string