Identity
Interface for a user identity.
since 5.4. Will be removed in 6.0. Use FOSHttpCacheBundle user context feature instead.
One can add any kind of information that can then be hashed and used as a fingerprint.
Typical use case is for content cache variation that you want to make vary on a bunch of user information (e.g. assigned roles). The more you add information, the more specific and fine grained your cache variation will be.
Tags
Methods¶
addInformation()
¶
Registers several pieces of information in the identity.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$information | array<string|int, mixed> | - |
Hash where key is the information type and value is a scalar. |
getHash()
¶
Returns the hash of the current identity (e.g. md5, sha1...).
|
|
Return values
string
getInformation()
¶
Returns registered information.
|
|
Return values
array<string|int, mixed>
replaceInformation()
¶
Replaces the information already registered in the identity.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$information | array<string|int, mixed> | - |
Hash where key is the information type and value is a scalar. |
setInformation()
¶
Registers an information in the identity.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$informationName | string | - | - |
$informationValue | scalar | - | - |