Back to ContentHistory class

Method store

public bool
store
(mixed $updateNulls = false)
Overrides Table::store to set modified hash, user id, and save date.
Parameters
  • bool $updateNulls True to update fields even if they are null.
Returns
  • bool True on success.
Since
  • 3.2

Method store - Source code

/**
 * Overrides Table::store to set modified hash, user id, and save date.
 *
 * @param   boolean  $updateNulls  True to update fields even if they are null.
 *
 * @return  boolean  True on success.
 *
 * @since   3.2
 */
public function store($updateNulls = false)
{
    $this->set('character_count', \strlen($this->get('version_data')));
    $typeTable = Table::getInstance('ContentType', 'JTable', array('dbo' => $this->getDbo()));
    $typeAlias = explode('.', $this->item_id);
    array_pop($typeAlias);
    $typeTable->load(array('type_alias' => implode('.', $typeAlias)));
    if (!isset($this->sha1_hash)) {
        $this->set('sha1_hash', $this->getSha1($this->get('version_data'), $typeTable));
    }
    // Modify author and date only when not toggling Keep Forever
    if ($this->get('keep_forever') === null) {
        $this->set('editor_user_id', Factory::getUser()->id);
        $this->set('save_date', Factory::getDate()->toSql());
    }
    return parent::store($updateNulls);
}