Session: How to Get Entity Change-Vector
-
The change-vector reflects the cluster-wide point in time in which a change occured, and includes the unique database ID, node identifier, and document Etag in the specific node.
-
When a document is downloaded from the server, it contains various metadata information.
E.g. ID or current change-vector. -
The current change-vector is stored within the session metadata and is available for each entity using the
getChangeVectorFor
method from theadvanced
session operations.
Syntax
public function getChangeVectorFor(?object $instance): ?string;
Parameter | Type | Description |
---|---|---|
$instance | ?object |
An instance of an entity for which an Etag will be returned |
Return Type | Description |
---|---|
?string |
Returns the current change-vector for an entity. Throws an exception if the entity is not tracked by the session. |
Example
$employee = $session->load(Employee::class, "employees/1-A");
$changeVector = $session->advanced()->getChangeVectorFor($employee);