DBFactory
in package
Table of Contents
- $db : mixed
- $instance : mixed
- create() : DB
- Creates or retrieves the existing DB instance.
- init() : DB
- Creates a new instance of the `DB` class for the specified table.
- resetInstance() : void
- Resets the instance.
Properties
$db
private
mixed
$db
$instance
private
static mixed
$instance
= null
Methods
create()
Creates or retrieves the existing DB instance.
public
static create([null|string $tableNameNoPrefix = null ]) : DB
Parameters
- $tableNameNoPrefix : null|string = null
-
Optional table name without prefix.
Return values
DB —init()
Creates a new instance of the `DB` class for the specified table.
public
static init(string $tableNameNoPrefix) : DB
This is useful in cases where a fresh instance of the DB
class
is required instead of a singleton.
Parameters
- $tableNameNoPrefix : string
-
The name of the database table without the prefix.
Return values
DB —An initialized DB
instance with the specified table.
resetInstance()
Resets the instance.
public
static resetInstance() : void
Useful for testing or clearing cached connections.