Back to User class

Method getTable

public static \Joomla\CMS\Table\Table
getTable
(mixed $type = null, mixed $prefix = 'JTable')
Method to get the user table object
Parameters
  • string $type The user table name to be used
  • string $prefix The user table prefix to be used
Returns
  • \Joomla\CMS\Table\Table The user table object
Since
  • 1.7.0
-
  • At 4.0 this method will no longer be static
Class: User
Project: Joomla

Method getTable - Source code

/**
 * Method to get the user table object
 *
 * This function uses a static variable to store the table name of the user table to
 * instantiate. You can call this function statically to set the table name if
 * needed.
 *
 * @param   string  $type    The user table name to be used
 * @param   string  $prefix  The user table prefix to be used
 *
 * @return  Table  The user table object
 *
 * @note    At 4.0 this method will no longer be static
 * @since   1.7.0
 */
public static function getTable($type = null, $prefix = 'JTable')
{
    static $tabletype;
    // Set the default tabletype;
    if (!isset($tabletype)) {
        $tabletype['name'] = 'user';
        $tabletype['prefix'] = 'JTable';
    }
    // Set a custom table type is defined
    if (isset($type)) {
        $tabletype['name'] = $type;
        $tabletype['prefix'] = $prefix;
    }
    // Create the user table object
    return Table::getInstance($tabletype['name'], $tabletype['prefix']);
}