eZ\Publish\Core\Persistence\Legacy\Content\TreeHandler::listVersions PHP Method

listVersions() public method

Result is returned with oldest version first (using version id as it has index and is auto increment).
public listVersions ( integer $contentId ) : eZ\Publish\SPI\Persistence\Content\VersionInfo[]
$contentId integer
return eZ\Publish\SPI\Persistence\Content\VersionInfo[]
    public function listVersions($contentId)
    {
        $rows = $this->contentGateway->listVersions($contentId);
        if (empty($rows)) {
            return array();
        }
        $idVersionPairs = array_map(function ($row) use($contentId) {
            return array('id' => $contentId, 'version' => $row['ezcontentobject_version_version']);
        }, $rows);
        $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs);
        return $this->contentMapper->extractVersionInfoListFromRows($rows, $nameRows);
    }

Usage Example

Beispiel #1
0
 /**
  * Returns the versions for $contentId.
  *
  * @param int $contentId
  *
  * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[]
  */
 public function listVersions($contentId)
 {
     return $this->treeHandler->listVersions($contentId);
 }
All Usage Examples Of eZ\Publish\Core\Persistence\Legacy\Content\TreeHandler::listVersions