Table
extends AbstractAdapter
in package
Auditor table class
Tags
Table of Contents
- CREATED = 'created'
- Constants for action states
- DELETED = 'deleted'
- UPDATED = 'updated'
- $action : string
- Action (created, updated, deleted)
- $domain : string
- Domain
- $metadata : array<string|int, mixed>
- Metadata
- $method : string
- Method
- $model : string
- Model name
- $modelId : int
- Model ID
- $modified : array<string|int, mixed>
- Modified model state differences
- $original : array<string|int, mixed>
- Original model state differences
- $route : string
- Route
- $table : string
- Table class name
- $userId : int
- User ID
- $username : string
- Username
- __construct() : mixed
- Constructor
- addMetadata() : self
- Add to the metadata
- getAction() : string
- Get the action
- getDomain() : string
- Get the domain
- getMetadata() : mixed
- Get the metadata
- getMethod() : string
- Get the method
- getModel() : string
- Get the model name
- getModelId() : int
- Get the model ID
- getModified() : array<string|int, mixed>
- Get the modified model state differences
- getOriginal() : array<string|int, mixed>
- Get the original model state differences
- getRoute() : string
- Get the route
- getSnapshot() : array<string|int, mixed>
- Get model snapshot by ID
- getStateByDate() : array<string|int, mixed>
- Get model state by date
- getStateById() : array<string|int, mixed>
- Get model state by ID
- getStateByModel() : array<string|int, mixed>
- Get model state by model
- getStateByTimestamp() : array<string|int, mixed>
- Get model state by timestamp
- getStates() : array<string|int, mixed>
- Get model states
- getTable() : string
- Get the table
- getUserId() : int
- Get the user ID
- getUsername() : string
- Get the username
- hasDiff() : bool
- Check if the model states are different
- hasMetadata() : bool
- Determine if there is metadata
- prepareData() : array<string|int, mixed>
- Prepare data
- resolveDiff() : self
- Resolve the differences in values between the model states
- send() : Record
- Send the results of the audit
- setDiff() : self
- Set the differences in values between the model states (that have already been processed)
- setDomain() : self
- Set the domain
- setMetadata() : self
- Set the metadata
- setMethod() : self
- Set the method
- setModel() : self
- Set the model name
- setModelId() : self
- Set the model ID
- setRoute() : self
- Set the route
- setTable() : Table
- Set the table
- setUserId() : self
- Set the user ID
- setUsername() : self
- Set the username
- createTable() : void
- Create table in database
Constants
CREATED
Constants for action states
public
int
CREATED
= 'created'
DELETED
public
mixed
DELETED
= 'deleted'
UPDATED
public
mixed
UPDATED
= 'updated'
Properties
$action
Action (created, updated, deleted)
protected
string
$action
= null
$domain
Domain
protected
string
$domain
= null
$metadata
Metadata
protected
array<string|int, mixed>
$metadata
= []
$method
Method
protected
string
$method
= null
$model
Model name
protected
string
$model
= null
$modelId
Model ID
protected
int
$modelId
= null
$modified
Modified model state differences
protected
array<string|int, mixed>
$modified
= []
$original
Original model state differences
protected
array<string|int, mixed>
$original
= []
$route
Route
protected
string
$route
= null
$table
Table class name
protected
string
$table
= null
$userId
User ID
protected
int
$userId
= null
$username
Username
protected
string
$username
= null
Methods
__construct()
Constructor
public
__construct(string $table) : mixed
Instantiate the table adapter object
Parameters
- $table : string
Return values
mixed —addMetadata()
Add to the metadata
public
addMetadata(string $name, mixed $value) : self
Parameters
- $name : string
- $value : mixed
Return values
self —getAction()
Get the action
public
getAction() : string
Return values
string —getDomain()
Get the domain
public
getDomain() : string
Return values
string —getMetadata()
Get the metadata
public
getMetadata([string $name = null ]) : mixed
Parameters
- $name : string = null
Return values
mixed —getMethod()
Get the method
public
getMethod() : string
Return values
string —getModel()
Get the model name
public
getModel() : string
Return values
string —getModelId()
Get the model ID
public
getModelId() : int
Return values
int —getModified()
Get the modified model state differences
public
getModified() : array<string|int, mixed>
Return values
array<string|int, mixed> —getOriginal()
Get the original model state differences
public
getOriginal() : array<string|int, mixed>
Return values
array<string|int, mixed> —getRoute()
Get the route
public
getRoute() : string
Return values
string —getSnapshot()
Get model snapshot by ID
public
getSnapshot(int $id[, bool $post = false ]) : array<string|int, mixed>
Parameters
- $id : int
- $post : bool = false
Return values
array<string|int, mixed> —getStateByDate()
Get model state by date
public
getStateByDate(string $from[, string $backTo = null ][, array<string|int, mixed> $columns = [] ]) : array<string|int, mixed>
Parameters
- $from : string
- $backTo : string = null
- $columns : array<string|int, mixed> = []
Return values
array<string|int, mixed> —getStateById()
Get model state by ID
public
getStateById(int $id) : array<string|int, mixed>
Parameters
- $id : int
Return values
array<string|int, mixed> —getStateByModel()
Get model state by model
public
getStateByModel(string $model[, int $modelId = null ][, array<string|int, mixed> $columns = [] ]) : array<string|int, mixed>
Parameters
- $model : string
- $modelId : int = null
- $columns : array<string|int, mixed> = []
Return values
array<string|int, mixed> —getStateByTimestamp()
Get model state by timestamp
public
getStateByTimestamp(string $from[, string $backTo = null ][, array<string|int, mixed> $columns = [] ]) : array<string|int, mixed>
Parameters
- $from : string
- $backTo : string = null
- $columns : array<string|int, mixed> = []
Return values
array<string|int, mixed> —getStates()
Get model states
public
getStates([array<string|int, mixed> $columns = null ][, array<string|int, mixed> $options = null ]) : array<string|int, mixed>
Parameters
- $columns : array<string|int, mixed> = null
- $options : array<string|int, mixed> = null
Return values
array<string|int, mixed> —getTable()
Get the table
public
getTable() : string
Return values
string —getUserId()
Get the user ID
public
getUserId() : int
Return values
int —getUsername()
Get the username
public
getUsername() : string
Return values
string —hasDiff()
Check if the model states are different
public
hasDiff() : bool
Return values
bool —hasMetadata()
Determine if there is metadata
public
hasMetadata([string $name = null ]) : bool
Parameters
- $name : string = null
Return values
bool —prepareData()
Prepare data
public
prepareData([bool $jsonEncode = true ]) : array<string|int, mixed>
Parameters
- $jsonEncode : bool = true
Return values
array<string|int, mixed> —resolveDiff()
Resolve the differences in values between the model states
public
resolveDiff([array<string|int, mixed> $old = [] ][, array<string|int, mixed> $new = [] ]) : self
Parameters
- $old : array<string|int, mixed> = []
- $new : array<string|int, mixed> = []
Return values
self —send()
Send the results of the audit
public
send() : Record
Tags
Return values
Record —setDiff()
Set the differences in values between the model states (that have already been processed)
public
setDiff([array<string|int, mixed> $old = [] ][, array<string|int, mixed> $new = [] ]) : self
Parameters
- $old : array<string|int, mixed> = []
- $new : array<string|int, mixed> = []
Return values
self —setDomain()
Set the domain
public
setDomain(string $domain) : self
Parameters
- $domain : string
Return values
self —setMetadata()
Set the metadata
public
setMetadata(array<string|int, mixed> $metadata) : self
Parameters
- $metadata : array<string|int, mixed>
Return values
self —setMethod()
Set the method
public
setMethod(string $method) : self
Parameters
- $method : string
Return values
self —setModel()
Set the model name
public
setModel(string $model) : self
Parameters
- $model : string
Return values
self —setModelId()
Set the model ID
public
setModelId(int $modelId) : self
Parameters
- $modelId : int
Return values
self —setRoute()
Set the route
public
setRoute(string $route) : self
Parameters
- $route : string
Return values
self —setTable()
Set the table
public
setTable(string $table) : Table
Parameters
- $table : string
Return values
Table —setUserId()
Set the user ID
public
setUserId(int $userId) : self
Parameters
- $userId : int
Return values
self —setUsername()
Set the username
public
setUsername(string $username) : self
Parameters
- $username : string
Return values
self —createTable()
Create table in database
protected
createTable(string $tableName) : void
Parameters
- $tableName : string