public function getAllLinearVersions($document, $limit = -1)
    {
        $path = $this->getDocumentId($document);
        $metadata = $this->dm->getClassMetadata(get_class($document));

        if (!$metadata->versionable) {
            throw new InvalidArgumentException(sprintf("The document of type '%s' is not versionable", $metadata->getName()));
        }

        $versions = $this->session
            ->getWorkspace()
            ->getVersionManager()
            ->getVersionHistory($path)
            ->getAllLinearVersions();

        $result = [];
        foreach ($versions as $version) {
            /* @var $version VersionInterface */
            $result[$version->getName()] = [
                'name'    => $version->getName(),
                'labels'  => [],
                'created' => $version->getCreated(),
            ];
        }

        return $result;
    }
public function getAllLinearVersions($document, $limit = -1)
    {
        $path = $this->getDocumentId($document);
        $metadata = $this->dm->getClassMetadata(get_class($document));

        if (!$metadata->versionable) {
            throw new InvalidArgumentException(sprintf("The document of type '%s' is not versionable", $metadata->getName()));
        }

        $versions = $this->session
            ->getWorkspace()
            ->getVersionManager()
            ->getVersionHistory($path)
            ->getAllLinearVersions();

        $result = [];
        foreach ($versions as $version) {
            /* @var $version VersionInterface */
            $result[$version->getName()] = [
                'name'    => $version->getName(),
                'labels'  => [],
                'created' => $version->getCreated(),
            ];
        }

        return $result;
    }
public function getAllLinearVersions ( $ document , $ limit = - 1 ) { $ path = $ this -> getDocumentId ( $ document ) ; $ metadata = $ this -> dm -> getClassMetadata ( get_class ( $ document ) ) ; if ( ! $ metadata -> versionable ) { throw new InvalidArgumentException ( sprintf ( "The document of type '%s' is not versionable" , $ metadata -> getName ( ) ) ) ; } $ versions = $ this -> session -> getWorkspace ( ) -> getVersionManager ( ) -> getVersionHistory ( $ path ) -> getAllLinearVersions ( ) ; $ result = [ ] ; foreach ( $ versions as $ version ) { /* @var $version VersionInterface */ $ result [ $ version -> getName ( ) ] = [ 'name' => $ version -> getName ( ) , 'labels' => [ ] , 'created' => $ version -> getCreated ( ) , ] ; } return $ result ; }
Get the version history information for a document.

TODO: implement labels once jackalope implements them, until then labels will be an empty array.
TODO: implement limit

@param object $document the document of which to get the version history
@param int    $limit    an optional limit to only get the latest $limit information

@return array of <versionname> => array("name" => <versionname>, "labels" => <array of labels>, "created" => <DateTime>)
oldest version first
Get the version history information for a document .