VersionableModelTrait
Defines the trait for a Versionable Model Class.
| since |
3.10.0 |
|---|---|
| package |
Joomla CMS |
Methods
deleteHistory
Method to delete the history for an item.
deleteHistory( typeAlias, id) :
| since |
6.0.0 |
|---|
Arguments
- typeAlias
stringTypealias of the component- id
intID of the content item to delete
Response
booltrue on success, otherwise false.
getHistoryData
Method to get the version data from the version history table.
getHistoryData( historyId) :
| since |
6.0.0 |
|---|
Arguments
- historyId
intKey to the version history table.
Response
mixedFalse on failure or error, data otherwise.
getHistoryTable
Method to get a version history table.
getHistoryTable( historyId) :
| since |
6.0.0 |
|---|
Arguments
- historyId
intKey to the version history table.
Response
mixedFalse on failure or error, table otherwise.
getItemIdFromHistory
Method to get the item id from the version history table.
getItemIdFromHistory( historyId) :
| since |
6.0.0 |
|---|
Arguments
- historyId
intKey to the version history table.
Response
intFalse on failure or error, id otherwise.
getSha1
Utility method to get the hash after removing selected values. This lets us detect changes other than modified date (which will change on every save).
getSha1( data) :
| since |
6.0.0 |
|---|
Arguments
- data
mixedEither an object or an array
Response
stringSHA1 hash on success. Empty string on failure.
loadHistory
Method to load a row for editing from the version history table.
loadHistory( historyId) :
| since |
6.0.0 |
|---|
Arguments
- historyId
intKey to the version history table.
Response
boolFalse on failure or error, true otherwise.
markVersionAsCurrent
Method to mark a version as current. When a version is marked as current, all other versions of same content item will be marked as not current.
markVersionAsCurrent( versionId, itemId) :
| since |
6.0.0 |
|---|
Arguments
- versionId
intThe version id to mark as current- itemId
stringThe item id of the content item
Response
void
saveHistory
Method to save the history.
saveHistory(mixed||string|int data, context) :
| since |
6.0.0 |
|---|
Arguments
- data
array<string|int, mixed>The form data.- context
stringThe model context.
Response
boolTrue on success, False on error.
setConvertToInt
Setter for the value
setConvertToInt(mixed||string|int convertToInt) :
| since |
6.0.0 |
|---|
Arguments
- convertToInt
array<string|int, mixed>
Response
void
setIgnoreChanges
Setter for the value
setIgnoreChanges(mixed||string|int ignoreChanges) :
| since |
6.0.0 |
|---|
Arguments
- ignoreChanges
array<string|int, mixed>
Response
void
storeHistory
Method to save a version snapshot to the content history table.
storeHistory( typeAlias, id, data, note = '') :
| since |
6.0.0 |
|---|---|
| throws |
|
Arguments
- typeAlias
stringTypealias of the content type- id
intID of the content item- data
mixedArray or object of data that can be en- and decoded into JSON- note
stringNote for the version to store
Response
boolTrue on success, otherwise false.
versionHistoryEnabled
Method to check if version history is enabled for a specific context.
versionHistoryEnabled( context) :
| since |
6.0.0 |
|---|
Arguments
- context
stringThe model context.
Response
boolTrue if version history is enabled, false otherwise.
Properties
ignoreChanges
Fields to be ignored when calculating the hash.
| since |
6.0.0 |
|---|
Type(s)
array<string|int, mixed>
convertToInt
Fields to be converted to int when calculating the hash.
| since |
6.0.0 |
|---|
Type(s)
array<string|int, mixed>