UserDataHashService
This service class contains functions related to hashing and data storage.
All public functions are available from the Twig template renderer.
Methods
public __construct($dataBase, $templateConfigService)
UserDataHashService constructor.
Type |
Name |
Description |
|
||
|
public find($hash, $contactId = null, $plentyId = null):UserDataHash
Get entry by hash if exists
Type |
Name |
Description |
|
The hash to search an entry for |
|
|
Optional: Restrict results to a contact id. Otherwise use logged in contact |
|
|
Optional: Use a specific plentyId. Otherwise use id of current client. |
public findHash($type, $contactId = null, $plentyId = null):string
Get the hash of a specific type if exists and is not expired.
Type |
Name |
Description |
|
The type to get the hash for |
|
|
Optional: Restrict results to a contact id. Otherwise use logged in contact |
|
|
Optional: Use a specific plentyId. Otherwise use id of current client. |
public getData($hash, $contactId = null, $plentyId = null):mixed
Get the decoded data assigned to a hash
Type |
Name |
Description |
|
The hash to search an entry for |
|
|
Optional: Restrict results to a contact id. Otherwise use logged in contact |
|
|
Optional: Use a specific plentyId. Otherwise use id of current client. |
public create($data, $type, $ttl = null, $contactId = null, $plentyId = null):UserDataHash
Create a new entry and assign data to the hash for later usage.
Type |
Name |
Description |
|
The data to assign to the generated hash entry |
|
|
The type of the entry |
|
|
Optional: Lifetime of the hash entry in hours. Will get the value from config if not defined. |
|
|
Optional: Restrict results to a contact id. Otherwise use logged in contact |
|
|
Optional: Use a specific plentyId. Otherwise use id of current client. |
public delete($hash, $contactId = null, $plentyId = null):bool
Remove a hash entry if exists.
Type |
Name |
Description |
|
The hash to search an entry for |
|
|
Optional: Restrict results to a contact id. Otherwise use logged in contact |
|
|
Optional: Use a specific plentyId. Otherwise use id of current client. |
public deleteAll($type = null, $contactId = null, $plentyId = null):bool
Delete all entries
Type |
Name |
Description |
|
Optional: Delete only entries for a specific type |
|
|
Optional: Restrict results to a contact id. Otherwise use logged in contact |
|
|
Optional: Use a specific plentyId. Otherwise use id of current client. |