/**
* Get latest available version, using $force always returns a version no matter if it is the same as the published one
* @param bool $force
* @return array
*/
public function getLatestVersion($force = false)
{
$versionData = $this->db->fetchRow("SELECT id,date FROM versions WHERE cid = ? AND ctype='document' ORDER BY `id` DESC LIMIT 1", $this->model->getId());
if ($versionData["id"] && $versionData["date"] > $this->model->getModificationDate() || $force) {
$version = Version::getById($versionData["id"]);
return $version;
}
return;
}