src/Sulu/Component/Hash/Serializer/Subscriber/HashSerializeEventSubscriber.php
public function onPostSerialize(ObjectEvent $event)
    {
        $object = $event->getObject();

        // FIXME This can be removed, as soon as we've got rid of all ApiEntities.
        if ($object instanceof ApiWrapper) {
            $object = $object->getEntity();
        }

        if (!$object instanceof AuditableInterface && !$object instanceof LocalizedAuditableBehavior) {
            return;
        }

        $visitor = $event->getVisitor();

        if (!$visitor instanceof GenericSerializationVisitor) {
            return;
        }

        $visitor->setData('_hash', $this->hasher->hash($object));
    }
public function onPostSerialize(ObjectEvent $event)
    {
        $object = $event->getObject();

        // FIXME This can be removed, as soon as we've got rid of all ApiEntities.
        if ($object instanceof ApiWrapper) {
            $object = $object->getEntity();
        }

        if (!$object instanceof AuditableInterface && !$object instanceof LocalizedAuditableBehavior) {
            return;
        }

        $visitor = $event->getVisitor();

        if (!$visitor instanceof GenericSerializationVisitor) {
            return;
        }

        $visitor->setData('_hash', $this->hasher->hash($object));
    }
public function onPostSerialize ( ObjectEvent $ event ) { $ object = $ event -> getObject ( ) ; // FIXME This can be removed, as soon as we've got rid of all ApiEntities. if ( $ object instanceof ApiWrapper ) { $ object = $ object -> getEntity ( ) ; } if ( ! $ object instanceof AuditableInterface && ! $ object instanceof LocalizedAuditableBehavior ) { return ; } $ visitor = $ event -> getVisitor ( ) ; if ( ! $ visitor instanceof GenericSerializationVisitor ) { return ; } $ visitor -> setData ( '_hash' , $ this -> hasher -> hash ( $ object ) ) ; }
Adds the hash of the given object to its serialization.

@param ObjectEvent $event
Adds the hash of the given object to its serialization .