Represents the changeset of an object.
A revision is a record of modifications to an object.
Intended to be used to collect all routes related to models
under a single source (e.g., database table).
Charcoal\Object\ObjectRoute
for a similar model that aggregates data
under a common source.
Methods summary
public
|
|
protected
|
#
setModelFactory( Charcoal\Factory\FactoryInterface $factory )
Parameters
- $factory
- The factory used to create models.
|
protected
Charcoal\Factory\FactoryInterface
|
#
modelFactory( )
Returns
Charcoal\Factory\FactoryInterface The model factory.
|
public
Charcoal\Object\ObjectRevision
|
#
setTargetType( string $targetType )
Parameters
- $targetType
- The object type (type-ident).
Returns
Throws
InvalidArgumentException If the obj type parameter is not a string.
Implementation of
|
public
string
|
|
public
Charcoal\Object\ObjectRevision
|
#
setTargetId( mixed $targetId )
Parameters
Returns
Implementation of
|
public
mixed
|
#
targetId( )
Returns
mixed
Implementation of
|
public
Charcoal\Object\ObjectRevision
|
#
setRevNum( integer $revNum )
Parameters
- $revNum
- The revision number.
Returns
Throws
InvalidArgumentException If the revision number argument is not numerical.
Implementation of
|
public
integer
|
#
revNum( )
Returns
integer
Implementation of
|
public
Charcoal\Object\ObjectRevision
|
#
setRevTs( mixed $revTs )
Parameters
- $revTs
- The revision's timestamp.
Returns
Throws
InvalidArgumentException If the timestamp is invalid.
Implementation of
|
public
DateTimeInterface|null
|
#
revTs( )
Returns
DateTimeInterface|null
Implementation of
|
public
Charcoal\Object\ObjectRevision
|
#
setRevUser( string $revUser )
Parameters
- $revUser
- The revision user ident.
Returns
Throws
InvalidArgumentException If the revision user parameter is not a string.
Implementation of
|
public
string
|
#
revUser( )
Returns
string
Implementation of
|
public
Charcoal\Object\ObjectRevision
|
#
setDataPrev( string|array $data )
Parameters
- $data
- The previous revision data.
Returns
Implementation of
|
public
array
|
#
dataPrev( )
Returns
array
Implementation of
|
public
Charcoal\Object\ObjectRevision
|
#
setDataObj( array|string $data )
Parameters
- $data
- The current revision (object) data.
Returns
Implementation of
|
public
array
|
#
dataObj( )
Returns
array
Implementation of
|
public
Charcoal\Object\ObjectRevision
|
#
setDataDiff( array|string $data )
Parameters
Returns
Implementation of
|
public
array
|
#
dataDiff( )
Returns
array
Implementation of
|
public
Charcoal\Object\ObjectRevision
|
#
createFromObject( Charcoal\Object\RevisionableInterface $obj )
Create a new revision from an object
Create a new revision from an object
- Load the last revision
- Load the current item from DB
- Create diff from (1) and (2).
Parameters
- $obj
- The object to create the revision from.
Returns
Implementation of
|
public
array
|
#
createDiff( array $dataPrev = null, array $dataObj = null )
Parameters
- $dataPrev
- Optional. Previous revision data.
- $dataObj
- Optional. Current revision (object) data.
Returns
array The diff data
Implementation of
|
public
array
|
#
recursiveDiff( array $array1, array $array2 )
Recursive arrayDiff.
Parameters
- $array1
- First array.
- $array2
- Second Array.
Returns
array The array diff.
Implementation of
|
public
Charcoal\Object\ObjectRevision
|
|
public
Charcoal\Object\ObjectRevision
|
#
objectRevisionNum( Charcoal\Object\RevisionableInterface $obj, integer $revNum )
Retrieve a specific object revision, by revision number.
Retrieve a specific object revision, by revision number.
Parameters
- $obj
- Target object.
- $revNum
- The revision number to load.
Returns
Implementation of
|