ExceptionLogModel
extends Record
in package
This is a lightweight model.
Table of Contents
Constants
Properties
- $caught : int
- $class_name : string
- $date_generated : string
- $exception_object : string
- $exception_trace : string
- $get_data : string
- $id : int
- $ip_address : string
- $message : string
- $server : string
- $session : string
- $session_id : string
- $type : string
- $_checksums : DirtyChecksums|null
Methods
- __construct() : mixed
- __serialize() : array<string|int, mixed>
- __unserialize() : void
- delete() : bool
- Delete this model.
- extraFields() : array<string|int, callable>
- Define extra fields that you _might_ want included in the `toArray()` output.
- fields() : array<string|int, mixed>
- find() : PdbModelQuery
- Create a query for this model.
- findAll() : array<string|int, static>
- Find a list of models.
- findOne() : static
- Find one model.
- findOrCreate() : static
- Find one model. Create a default one if not found.
- getChecksums() : DirtyChecksums
- Get a checksums store for this object.
- getConnection() : Pdb
- The connection used queries in this model.
- getFieldDefaults() : array<string|int, mixed>
- Get a list of default values for the database record.
- getIterator() : Traversable
- getSaveData() : array<string|int, mixed>
- Data to be inserted or updated.
- getTableName() : string
- The table name for this model, non-prefixed.
- getUid() : string
- It's made up (not stored).
- jsonSerialize() : mixed
- offsetExists() : bool
- offsetGet() : mixed
- offsetSet() : void
- offsetUnset() : void
- parseJsPayload() : void
- Parses the JSON payload from kbtrace into something that Sprout is happy to store.
- populate() : void
- Populate a model with a DB row.
- populateDefaults() : void
- Loads default values from database table schema.
- reference() : string
- The reference string - TYPE + ID.
- renderTrace() : string
- Render a pretty stack trace.
- save() : bool
- Save this model.
- toArray() : array<string|int, mixed>
- Convert this object to an array.
- update() : void
- _afterSave() : void
- Performed after all save actions.
- _beforeSave() : void
- Performed before all save actions.
- _internalSave() : void
- Perform inserts and updates.
- getFieldList() : array<string, PdbColumn>
- Get the field definitions for the table that holds this record
- getFieldType() : string|null
- Test for a field type.
- getSerializedProperties() : array<string|int, mixed>
- Get an array of properties to serialize.
- typeCastValue() : void
- Convert a property value to it's appropriate type.
Constants
TYPE_JS
public
mixed
TYPE_JS
= 'js'
TYPE_PHP
public
mixed
TYPE_PHP
= 'php'
Properties
$caught
public
int
$caught
$class_name
public
string
$class_name
$date_generated
public
string
$date_generated
$exception_object
public
string
$exception_object
$exception_trace
public
string
$exception_trace
$get_data
public
string
$get_data
$id
public
int
$id
= 0
$ip_address
public
string
$ip_address
$message
public
string
$message
$server
public
string
$server
$session
public
string
$session
$session_id
public
string
$session_id
$type
public
string
$type
$_checksums
private
DirtyChecksums|null
$_checksums
Methods
__construct()
public
__construct([iterable<string|int, mixed> $config = [] ]) : mixed
Parameters
- $config : iterable<string|int, mixed> = []
__serialize()
public
__serialize() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
Tags
delete()
Delete this model.
public
delete() : bool
Tags
Return values
bool —True if the record was deleted.
extraFields()
Define extra fields that you _might_ want included in the `toArray()` output.
public
extraFields() : array<string|int, callable>
These are virtual fields that are not included by default like the
ones defined in fields(). Instead, use the second parameter of
the toArray(null, ['name']) method to specify which extra fields
you want in the output.
A virtual field is defined as a pair like 'name' => callback.
Tags
Return values
array<string|int, callable>fields()
public
fields() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>find()
Create a query for this model.
public
static find([array<string|int, mixed> $conditions = [] ]) : PdbModelQuery
Parameters
- $conditions : array<string|int, mixed> = []
Return values
PdbModelQueryfindAll()
Find a list of models.
public
static findAll([array<string|int, mixed> $conditions = [] ]) : array<string|int, static>
Parameters
- $conditions : array<string|int, mixed> = []
Return values
array<string|int, static>findOne()
Find one model.
public
static findOne(array<string|int, mixed> $conditions) : static
Parameters
- $conditions : array<string|int, mixed>
Return values
staticfindOrCreate()
Find one model. Create a default one if not found.
public
static findOrCreate(array<string|int, mixed> $conditions[, bool $update = true ]) : static
Parameters
- $conditions : array<string|int, mixed>
- $update : bool = true
-
If true, set 'conditions' as properties on the model.
Tags
Return values
staticgetChecksums()
Get a checksums store for this object.
public
getChecksums() : DirtyChecksums
Call this ASAP in your object lifecycle, i.e. the constructor.
Note this only tracks public properties.
Return values
DirtyChecksumsgetConnection()
The connection used queries in this model.
public
static getConnection() : Pdb
Tags
Return values
PdbgetFieldDefaults()
Get a list of default values for the database record.
public
static getFieldDefaults() : array<string|int, mixed>
Return values
array<string|int, mixed>getIterator()
public
getIterator() : Traversable
Tags
Return values
TraversablegetSaveData()
Data to be inserted or updated.
public
getSaveData() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —[ column => value ]
getTableName()
The table name for this model, non-prefixed.
public
static getTableName() : string
Tags
Return values
stringgetUid()
It's made up (not stored).
public
getUid() : string
Pretty much just so we're API compliant with kbtrace.
Return values
stringjsonSerialize()
public
jsonSerialize() : mixed
Tags
offsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
Tags
Attributes
- #[ReturnTypeWillChange]
offsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
parseJsPayload()
Parses the JSON payload from kbtrace into something that Sprout is happy to store.
public
parseJsPayload(array<string|int, mixed> $payload) : void
Parameters
- $payload : array<string|int, mixed>
Tags
populate()
Populate a model with a DB row.
public
static populate(static $instance, array<string|int, mixed> $config) : void
Extend this to implement custom logic, e.g. dirty property behaviour.
Parameters
- $instance : static
- $config : array<string|int, mixed>
populateDefaults()
Loads default values from database table schema.
public
populateDefaults() : void
This will only set defaults values for properties that are null.
reference()
The reference string - TYPE + ID.
public
reference() : string
Return values
stringrenderTrace()
Render a pretty stack trace.
public
renderTrace() : string
This is different for PHP vs JS.
Return values
stringsave()
Save this model.
public
save() : bool
Tags
Return values
booltoArray()
Convert this object to an array.
public
toArray([array<string|int, string>|null $filter = null ][, array<string|int, string>|null $extra = null ][, bool $nulls = false ]) : array<string|int, mixed>
Specify a 'filter' to restrict the fields included in the output.
Specify an 'extra' to include additional fields if implementing the
ArrayableFields interface. This will add properties that were excluded
from fields() and includes any virtual fields defined in extraFields().
included in fields() and any virtual fields defined in extraFields().
Parameters
- $filter : array<string|int, string>|null = null
- $extra : array<string|int, string>|null = null
- $nulls : bool = false
-
- include null fields in the output
Return values
array<string|int, mixed>update()
public
update(iterable<string|int, mixed> $config) : void
Parameters
- $config : iterable<string|int, mixed>
_afterSave()
Performed after all save actions.
protected
_afterSave(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
-
as created by getSaveData()
_beforeSave()
Performed before all save actions.
protected
_beforeSave() : void
_internalSave()
Perform inserts and updates.
protected
_internalSave(array<string|int, mixed> &$data) : void
This is wrapped by the save() method with a transaction.
This modifies the 'ID' into the $data array to the
Parameters
- $data : array<string|int, mixed>
-
as created by getSaveData(), this is mutable
Tags
getFieldList()
Get the field definitions for the table that holds this record
protected
static getFieldList() : array<string, PdbColumn>
Return values
array<string, PdbColumn>getFieldType()
Test for a field type.
protected
static getFieldType(string $field_name) : string|null
Parameters
- $field_name : string
Return values
string|nullgetSerializedProperties()
Get an array of properties to serialize.
protected
getSerializedProperties() : array<string|int, mixed>
Override this to modify the behaviour of the serializer.
By default, this returns properties that are:
- public
- not private or protected
- not static
- not implementing
NotSerializable
Return values
array<string|int, mixed> —[string => value]
typeCastValue()
Convert a property value to it's appropriate type.
protected
static typeCastValue(static $instance, string $property, mixed &$value) : void
Supported types:
- array: from JSON-encoded string
- array: from comma-separated SET
- bool: from '0' or '1'
- int: from numeric string
- float: from numeric string
- datetime: from string
- string: from anything else
Parameters
- $instance : static
- $property : string
- $value : mixed