Actions

API16

JTable/reset

From Joomla! Documentation

< API16:JTable
Revision as of 17:41, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

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.

[Edit Descripton]

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

[Edit See Also] SeeAlso:JTable/reset

Examples

<CodeExamplesForm />