API16

API16:JTableContent/store

From Joomla! Documentation

Revision as of 22:42, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Overriden JTable::store to set modified data and user id. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JTableContent/store|Edit ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Overriden JTable::store to set modified data and user id.

[Edit Descripton]

Template:Description:JTableContent/store

Syntax

store($updateNulls=false)
Parameter Name Default Value Description
$updateNulls false True to update fields even if they are null.

Returns

boolean True on success.

Defined in

libraries/joomla/database/table/content.php

Importing

jimport( 'joomla.database.table.content' );

Source Body

public function store($updateNulls = false)
{
        $date   = JFactory::getDate();
        $user   = JFactory::getUser();
        if ($this->id) {
                // Existing item
                $this->modified         = $date->toMySQL();
                $this->modified_by      = $user->get('id');
        } else {
                // New article. An article created and created_by field can be set by the user,
                // so we don't touch either of these if they are set.
                if (!intval($this->created)) {
                        $this->created = $date->toMySQL();
                }
                if (empty($this->created_by)) {
                        $this->created_by = $user->get('id');
                }
        }

        return parent::store($updateNulls);
}

[Edit See Also] Template:SeeAlso:JTableContent/store

Examples

<CodeExamplesForm />