\Charcoal\ObjectObjectRevisionInterface

Defines a changeset of an object implementing {@see \Charcoal\Object\RevisionableInterface}.

\Charcoal\Object\ObjectRevision for a basic implementation.

Summary

Methods
Constants
setTargetType()
targetType()
setTargetId()
targetId()
setRevNum()
revNum()
setRevTs()
revTs()
setRevUser()
revUser()
setDataPrev()
dataPrev()
setDataObj()
dataObj()
setDataDiff()
dataDiff()
createFromObject()
createDiff()
recursiveDiff()
lastObjectRevision()
objectRevisionNum()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

setTargetType()

setTargetType(string  $targetType) : \Charcoal\Object\ObjectRevisionInterface

Parameters

string $targetType

The object type (type-ident).

Returns

\Charcoal\Object\ObjectRevisionInterface

Chainable

targetType()

targetType() : string

Returns

string

targetId()

targetId() : mixed

Returns

mixed

revNum()

revNum() : integer

Returns

integer

revTs()

revTs() : \Charcoal\Object\DateTime|null

Returns

\Charcoal\Object\DateTime|null

setRevUser()

setRevUser(string  $revUser) : \Charcoal\Object\ObjectRevisionInterface

Parameters

string $revUser

The revision user ident.

Returns

\Charcoal\Object\ObjectRevisionInterface

Chainable

revUser()

revUser() : string

Returns

string

setDataPrev()

setDataPrev(array|string  $data) : \Charcoal\Object\ObjectRevision

Parameters

array|string $data

The previous revision data.

Returns

\Charcoal\Object\ObjectRevision

dataPrev()

dataPrev() : array

Returns

array

setDataObj()

setDataObj(array|string  $data) : \Charcoal\Object\ObjectRevision

Parameters

array|string $data

The current revision (object) data.

Returns

\Charcoal\Object\ObjectRevision

dataObj()

dataObj() : array

Returns

array

setDataDiff()

setDataDiff(array|string  $data) : \Charcoal\Object\ObjectRevision

Parameters

array|string $data

The data diff.

Returns

\Charcoal\Object\ObjectRevision

dataDiff()

dataDiff() : array

Returns

array

createFromObject()

createFromObject(\Charcoal\Object\RevisionableInterface  $obj) : \Charcoal\Object\ObjectRevision

Create a new revision from an object

  1. Load the last revision
  2. Load the current item from DB
  3. Create diff from (1) and (2).

Parameters

\Charcoal\Object\RevisionableInterface $obj

The object to create the revision from.

Returns

\Charcoal\Object\ObjectRevision

Chainable

createDiff()

createDiff(array  $dataPrev, array  $dataObj) : array

Parameters

array $dataPrev

Optional. The previous revision data.

array $dataObj

Optional. The current revision (object) data.

Returns

array —

The diff data

recursiveDiff()

recursiveDiff(array  $array1, array  $array2) : array

Recursive arrayDiff.

Parameters

array $array1

First array.

array $array2

Second array.

Returns

array —

The array diff.

objectRevisionNum()

objectRevisionNum(\Charcoal\Object\RevisionableInterface  $obj, integer  $revNum) : \Charcoal\Object\ObjectRevision

Retrieve a specific object revision, by revision number.

Parameters

\Charcoal\Object\RevisionableInterface $obj

Target object.

integer $revNum

The revision number to load.

Returns

\Charcoal\Object\ObjectRevision