API16

API16:JTable/reset

From Joomla! Documentation

Revision as of 14:29, 24 March 2017 by JoomlaWikiBot (talk | contribs) (clean up)

Description

Method to reset class properties to the defaults set in the class definition. It will ignore the primary key as well as any private class properties.


{{subst:Description:JTable/reset}}

Syntax

reset()


Returns

void

Defined in

libraries/joomla/database/table.php

Importing

jimport( 'joomla.database.table' );

Source Body

public function reset()
{
        // Get the default values for the class from the table.
        foreach ($this->getFields() as $k => $v) {
                // If the property is not the primary key or private, reset it.
                if ($k != $this->_tbl_key && (strpos($k, '_') !== 0)) {
                        $this->$k = $v->Default;
                }
        }
}


{{subst:SeeAlso:JTable/reset}}

Examples

<CodeExamplesForm />