FOF30\Model\DataModel::loadhistory PHP Метод

loadhistory() публичный Метод

Method to load a row for editing from the version history table.
С версии: 2.3
public loadhistory ( integer $version_id, string $alias ) : boolean
$version_id integer Key to the version history table.
$alias string The type_alias in #__content_types
Результат boolean True on success
    public function loadhistory($version_id, $alias)
    {
        // Only attempt to check the row in if it exists.
        if (!$version_id) {
            throw new RecordNotLoaded();
        }
        // Get an instance of the row to checkout.
        $historyTable = \JTable::getInstance('Contenthistory');
        if (!$historyTable->load($version_id)) {
            throw new BaseException($historyTable->getError());
        }
        $rowArray = \JArrayHelper::fromObject(json_decode($historyTable->version_data));
        $typeId = \JTable::getInstance('Contenttype')->getTypeId($alias);
        if ($historyTable->ucm_type_id != $typeId) {
            $key = $this->getKeyName();
            if (isset($rowArray[$key])) {
                $this->{$this->idFieldName} = $rowArray[$key];
                $this->unlock();
            }
            throw new BaseException(\JText::_('JLIB_APPLICATION_ERROR_HISTORY_ID_MISMATCH'));
        }
        $this->setState('save_date', $historyTable->save_date);
        $this->setState('version_note', $historyTable->version_note);
        $this->bind($rowArray);
        return true;
    }