Method |
Description |
|
__construct ( array $data = [] ) |
Constructor - allows setting of object properties with array on construct |
|
__destruct ( ) |
Do some cleanup of stored relations so orphaned relations are not held
in memory |
|
__get ( string $field ) : boolean | mixed | null |
Getter for field properties |
|
__isset ( string $key ) : boolean |
Enable isset() for object properties |
|
__set ( string $field, mixed $value ) |
Setter for field properties |
|
__toString ( ) : string |
String representation of the class (JSON) |
|
data ( null | array $data = null, boolean $modified = true, boolean $loadRelations = true ) |
Gets and sets data on the current entity |
|
dataExcept ( array $except ) : array |
Return array of field data with data from the field names listed removed |
|
dataModified ( null | string $field = null ) : array | boolean |
Gets data that has been modified since object construct,
optionally allowing for selecting a single field |
|
dataUnmodified ( null | string $field = null ) : array | boolean |
Gets data that has not been modified since object construct,
optionally allowing for selecting a single field |
|
entity ( ) |
Helper function so entity can be accessed via relation in a more
consistent manner with 'entity()' without any errors (i.e. relation will
not error if it already has a loaded entity object - it just returns
$this) |
|
error ( string $field, mixed $msg ) |
Add an error to error messages array |
|
errors ( string | array $msgs = null, boolean $overwrite = true ) : array | boolean | Entity |
Error message getter/setter |
|
events ( EventEmitter $eventEmitter ) |
Add events to this entity |
|
fields ( ) : array |
Return defined fields of the entity |
|
get ( string $field ) : boolean | mixed | null |
|
|
hasErrors ( string $field = null ) : boolean |
Check if any errors exist |
|
isModified ( null | string $field = null ) : boolean | null |
Returns true if a field has been modified. |
|
isNew ( null $new = null ) : boolean |
Is entity new (unsaved)? |
|
jsonSerialize ( ) |
JsonSerializable |
|
mapper ( ) : boolean |
Mapper name getter |
|
primaryKey ( ) : mixed |
Get the value of the primary key field defined on this entity |
|
primaryKeyField ( ) : string |
Get primary key field name |
|
relation ( string $relationName, null $relationObj = null ) : boolean | mixed |
Get/Set relation |
|
relations ( spot\MapperInterface $mapper, spot\EntityInterface $entity ) : array |
Return defined fields of the entity |
|
scopes ( ) |
Return scopes defined by this entity. Scopes are called from the
Spot\Query object as a sort of in-context dynamic query method |
|
set ( string $field, mixed $value, boolean $modified = true ) |
|
|
table ( string | null $tableName = null ) : string |
Table name getter/setter |
|
tableOptions ( null | array $tableOpts = null ) : array |
Datasource options getter/setter |
|
toArray ( ) : array |
Alias of self::data() |
|