src/Sulu/Component/DocumentManager/Subscriber/Behavior/VersionSubscriber.php
public function setVersionsOnDocument(HydrateEvent $event)
    {
        $document = $event->getDocument();

        if (!$this->support($document)) {
            return;
        }

        $node = $event->getNode();

        $versions = [];
        $versionProperty = $node->getPropertyValueWithDefault(static::VERSION_PROPERTY, []);
        foreach ($versionProperty as $version) {
            $versionInformation = json_decode($version);
            $versions[] = new Version(
                $versionInformation->version,
                $versionInformation->locale,
                $versionInformation->author,
                new \DateTime($versionInformation->authored)
            );
        }

        $document->setVersions($versions);
    }
public function setVersionsOnDocument(HydrateEvent $event)
    {
        $document = $event->getDocument();

        if (!$this->support($document)) {
            return;
        }

        $node = $event->getNode();

        $versions = [];
        $versionProperty = $node->getPropertyValueWithDefault(static::VERSION_PROPERTY, []);
        foreach ($versionProperty as $version) {
            $versionInformation = json_decode($version);
            $versions[] = new Version(
                $versionInformation->version,
                $versionInformation->locale,
                $versionInformation->author,
                new \DateTime($versionInformation->authored)
            );
        }

        $document->setVersions($versions);
    }
public function setVersionsOnDocument ( HydrateEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> support ( $ document ) ) { return ; } $ node = $ event -> getNode ( ) ; $ versions = [ ] ; $ versionProperty = $ node -> getPropertyValueWithDefault ( static :: VERSION_PROPERTY , [ ] ) ; foreach ( $ versionProperty as $ version ) { $ versionInformation = json_decode ( $ version ) ; $ versions [ ] = new Version ( $ versionInformation -> version , $ versionInformation -> locale , $ versionInformation -> author , new \ DateTime ( $ versionInformation -> authored ) ) ; } $ document -> setVersions ( $ versions ) ; }
Sets the version information set on the node to the document.

@param HydrateEvent $event
Sets the version information set on the node to the document .