public function generateValueHash(JoinPointInterface $joinPoint)
{
$proxy = $joinPoint->getProxy();
$proxyClassName = get_class($proxy);
$hashSourceParts = [];
$classSchema = $this->reflectionService->getClassSchema($proxyClassName);
foreach ($classSchema->getProperties() as $property => $propertySchema) {
// Currently, private properties are transient. Should this behaviour change, they need to be included
// in the value hash generation
if ($classSchema->isPropertyTransient($property) || $this->reflectionService->isPropertyPrivate($proxyClassName, $property)) {
continue;
}
$propertyValue = ObjectAccess::getProperty($proxy, $property, true);
if (is_object($propertyValue) === true) {
// The persistence manager will return NULL if the given object is unknown to persistence
$propertyValue = $this->persistenceManager->getIdentifierByObject($propertyValue) ?: $propertyValue;
}
$hashSourceParts[$property] = $propertyValue;
}
ksort($hashSourceParts);
$hashSourceParts['__class_name__'] = $proxyClassName;
$serializedSource = $this->useIgBinary === true ? igbinary_serialize($hashSourceParts) : serialize($hashSourceParts);
$proxy = $joinPoint->getProxy();
ObjectAccess::setProperty($proxy, 'Persistence_Object_Identifier', sha1($serializedSource), true);
}