MappedRecordFixture
extends Record
in package
uses
MapProperties
Table of Contents
Properties
- $mappedProp1 : mixed
- $mappedProp2 : mixed
- $unmappedProp : mixed
- $spec : Spec|null
Methods
- __construct() : mixed
- Construct a new instance of the object from an associative array of data properties.
- create() : static|null
- Insert a new record into the database and return on an instance of this object representing that record, if successfully inserted.
- delete() : static|null
- Delete a record from the database, returning an object representing the deleted record, if successful
- fixtureGetSpec() : mixed
- read() : static|null
- Read a record from the database and return an instance of this object representing that record, if present
- retrieve() : array<string|int, static>
- Retrieve all records matching an optional array of properties as an array of objects representing those records
- save() : void
- update() : static|null
- Update a record in the database and return an instance of this object representing that record, if successful
- databaseToObjectHook() : array<string|int, mixed>
- definePropertyToFieldMapping() : array<string|int, mixed>
- defineSpec() : Spec
- getSpec() : Spec
- objectToDatabaseHook() : array<string|int, mixed>
- assign() : mixed
- cloneIntoSelf() : mixed
- getPrimaryKey() : mixed
Properties
$mappedProp1
public
mixed
$mappedProp1
$mappedProp2
public
mixed
$mappedProp2
$unmappedProp
public
mixed
$unmappedProp
$spec
protected
static Spec|null
$spec
Methods
__construct()
Construct a new instance of the object from an associative array of data properties.
public
__construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
-
Associative array of properties (keys that do not exactly match a declared property will be ignored)
create()
Insert a new record into the database and return on an instance of this object representing that record, if successfully inserted.
public
static create(array<string|int, mixed> $data) : static|null
Parameters
- $data : array<string|int, mixed>
-
Associative array of properties (keys that do not exactly match a declared property will be ignored)
Return values
static|nulldelete()
Delete a record from the database, returning an object representing the deleted record, if successful
public
static delete(mixed $id) : static|null
Parameters
- $id : mixed
-
Primary key value
Return values
static|nullfixtureGetSpec()
public
fixtureGetSpec() : mixed
read()
Read a record from the database and return an instance of this object representing that record, if present
public
static read(mixed $id) : static|null
Parameters
- $id : mixed
-
Primary key value
Return values
static|nullretrieve()
Retrieve all records matching an optional array of properties as an array of objects representing those records
public
static retrieve([array<string|int, mixed> $data = [] ]) : array<string|int, static>
Parameters
- $data : array<string|int, mixed> = []
-
Optional associative array of properties to match (keys that do not exactly match a declared property will be ignored)
Return values
array<string|int, static>save()
public
save([array<string|int, mixed> $data = [] ]) : void
Parameters
- $data : array<string|int, mixed> = []
update()
Update a record in the database and return an instance of this object representing that record, if successful
public
static update(array<string|int, mixed> $data) : static|null
Parameters
- $data : array<string|int, mixed>
-
Associative array of properties (keys that do not exactly match a declared property will be ignored). Must include a primary key property to identify the record to be updated.
Return values
static|nulldatabaseToObjectHook()
protected
static databaseToObjectHook(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
Return values
array<string|int, mixed>definePropertyToFieldMapping()
protected
abstract static definePropertyToFieldMapping() : array<string|int, mixed>
Return values
array<string|int, mixed>defineSpec()
protected
static defineSpec() : Spec
Return values
SpecgetSpec()
protected
static getSpec() : Spec
Return values
SpecobjectToDatabaseHook()
protected
static objectToDatabaseHook(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
Return values
array<string|int, mixed>assign()
private
assign(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
cloneIntoSelf()
private
cloneIntoSelf(self $other) : mixed
Parameters
- $other : self
getPrimaryKey()
private
getPrimaryKey() : mixed