Interprets classes and annotations, and manipulates objects.
Programmer's Note: Manipulating subclasses through a parent's reflection is allowed.
@TODO Allow column aliasing.
Public Properties | |
const | SCALARS |
Maps annotated/native scalar types to storage types acceptable for settype() More... | |
Protected Properties | |
ReflectionClass | $class |
string[] | $columns |
DB | $db |
array | $defaults = [] |
ReflectionProperty[] | $properties = [] |
const | RX_EAV = '/\*\h*@eav\h+(?<table>\w+)/i' |
const | RX_EAV_VAR = '/\*\h*@var\h+(?<type>\w+)\[\]/i' |
const | RX_FOREIGN = '/\*\h*@foreign\h+(?<column>\w+)\h+(?<class>\S+)/i' |
const | RX_IS_COLUMN = '/\*\h*@col(umn)?\b/i' |
const | RX_JUNCTION = '/\*\h*@junction\h+(?<table>\w+)/i' |
const | RX_NULL = '/(\bnull\|)|(\|null\b)/i' |
const | RX_RECORD = '/\*\h*@record\h+(?<table>\w+)/i' |
const | RX_UNIQUE = '/^\h*\*\h*@unique\h*$/im' |
const | RX_UNIQUE_GROUP = '/^\h*\*\h*@unique\h+(?<ident>[a-z_]+)\h*$/im' |
const | RX_VAR = '/\*\h*@var\h+(?<type>\S+)/i' |
Public Static Methods | |
magic static self | factory (DB $db, string|object $class) |
Public Methods | |
__construct (DB $db, $class) | |
string[] | getColumns () |
EAV[] | getEav () |
string[] | getForeignClasses () |
Classes keyed by column. More... | |
string | getJunctionTable () |
string | getRecordTable () |
string | getType (string $property) |
Scalar storage type, or FQN of a complex type. More... | |
string[] | getUnique () |
Columns with their own individual unique constraints. More... | |
string[][] | getUniqueGroups () |
Table-level (multi-column) constraints are grouped under an arbitrary shared identifier. More... | |
mixed | getValue (object $object, string $property) |
Gets and returns a value through reflection. More... | |
bool | isColumn (string $property) |
bool | isNullable (string $property) |
Whether a property allows NULL as a value. More... | |
bool | isUnique (string $column) |
bool | isUniqueMulti (string $column, &$ident=null) |
object | newProto () |
void | setValue (object $object, string $property, $value) |
Sets a value through reflection. More... | |
const SCALARS |
Maps annotated/native scalar types to storage types acceptable for settype()
__construct | ( | DB | $db, |
$class | |||
) |
DB | $db | |
string | object | $class |
Reimplemented in Serializer.
|
final |
string [] getForeignClasses | ( | ) |
Classes keyed by column.
string getJunctionTable | ( | ) |
string getRecordTable | ( | ) |
string getType | ( | string | $property | ) |
Scalar storage type, or FQN of a complex type.
string | $property |
string [] getUnique | ( | ) |
Columns with their own individual unique constraints.
string [][] getUniqueGroups | ( | ) |
Table-level (multi-column) constraints are grouped under an arbitrary shared identifier.
[ shared identifier => [ col, ... ], ... ]
mixed getValue | ( | object | $object, |
string | $property | ||
) |
Gets and returns a value through reflection.
object | $object | |
string | $property |
bool isColumn | ( | string | $property | ) |
string | $property |
bool isNullable | ( | string | $property | ) |
Whether a property allows NULL
as a value.
string | $property |
bool isUnique | ( | string | $column | ) |
string | $column |
bool isUniqueMulti | ( | string | $column, |
& | $ident = null |
||
) |
string | $column | |
void | $ident | Updated to the group identifier. |
object newProto | ( | ) |
void setValue | ( | object | $object, |
string | $property, | ||
$value | |||
) |
Sets a value through reflection.
object | $object | |
string | $property | |
mixed | $value |