API16

JTable/reset

From Joomla! Documentation

< API16:JTable

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

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.



Syntax[edit]

reset()


Returns[edit]

void

Defined in[edit]

libraries/joomla/database/table.php

Importing[edit]

jimport( 'joomla.database.table' );

Source Body[edit]

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;
                }
        }
}



Examples[edit]

Code Examples[edit]