Documentation

ExceptionLogModel extends Record
in package

This is a lightweight model.

Table of Contents

Constants

TYPE_JS  : mixed = 'js'
TYPE_PHP  : mixed = 'php'

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

Properties

Methods

__construct()

public __construct([iterable<string|int, mixed> $config = [] ]) : mixed
Parameters
$config : iterable<string|int, mixed> = []

__serialize()

public __serialize() : array<string|int, mixed>
Tags
inheritdoc
Return values
array<string|int, mixed>

__unserialize()

public __unserialize(array<string|int, mixed> $serialized) : void
Parameters
$serialized : array<string|int, mixed>
Tags
inheritdoc

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
see
ArrayableFields
ArrayableTrait
Return values
array<string|int, callable>

fields()

public fields() : array<string|int, mixed>
Tags
inheritdoc
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
PdbModelQuery

findAll()

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
static

findOrCreate()

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
see

{PdbQuery::find()}

Return values
static

getConnection()

The connection used queries in this model.

public static getConnection() : Pdb
Tags
inheritdoc
Return values
Pdb

getFieldDefaults()

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
inheritdoc
Return values
Traversable

getSaveData()

Data to be inserted or updated.

public getSaveData() : array<string|int, mixed>
Tags
inheritdoc
Return values
array<string|int, mixed> —

[ column => value ]

getTableName()

The table name for this model, non-prefixed.

public static getTableName() : string
Tags
inheritdoc
Return values
string

getUid()

It's made up (not stored).

public getUid() : string

Pretty much just so we're API compliant with kbtrace.

Return values
string

jsonSerialize()

public jsonSerialize() : mixed
Tags
inheritdoc

offsetExists()

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed
Tags
inheritdoc
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
throws
HttpException

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
string

renderTrace()

Render a pretty stack trace.

public renderTrace() : string

This is different for PHP vs JS.

Return values
string

toArray()

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
throws
RowMissingException

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|null

getSerializedProperties()

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
On this page

Search results