Pimcore\Controller\Action\Admin\Document::getLatestVersion PHP Method

getLatestVersion() protected method

protected getLatestVersion ( Document $document ) : Document
$document Pimcore\Model\Document
return Pimcore\Model\Document
    protected function getLatestVersion(Model\Document $document)
    {
        $latestVersion = $document->getLatestVersion();
        if ($latestVersion) {
            $latestDoc = $latestVersion->loadData();
            if ($latestDoc instanceof Model\Document) {
                $latestDoc->setModificationDate($document->getModificationDate());
                // set de modification-date from published version to compare it in js-frontend
                return $latestDoc;
            }
        }
        return $document;
    }