/** * Returns a version by its offset. * * @param int $entryId * @param int $offset * * @deprecated Deprecated in 2.1. * @return EntryVersionModel|null */ public function getVersionByOffset($entryId, $offset = 0) { craft()->deprecator->log('EntryRevisionsService::getVersionByOffset()', 'EntryRevisionsService::getVersionByOffset() has been deprecated.'); $versionRecord = EntryVersionRecord::model()->findByAttributes(array('entryId' => $entryId, 'locale' => craft()->i18n->getPrimarySiteLocale())); if ($versionRecord) { return EntryVersionModel::populateModel($versionRecord); } }
/** * Returns versions by an entry ID. * * @param int $entryId * @param string $localeId * @return array */ public function getVersionsByEntryId($entryId, $localeId) { if (!$localeId) { $localeId = craft()->i18n->getPrimarySiteLocale(); } $versionRecords = EntryVersionRecord::model()->findAllByAttributes(array('entryId' => $entryId, 'locale' => $localeId)); return EntryVersionModel::populateModels($versionRecords, 'versionId'); }