Database
in package
PDO database singleton.
Provides a single shared PDO connection instance for the application.
Tags
Table of Contents
Properties
- $instance : PDO|null
Methods
- getInstance() : PDO
- Get the PDO database connection instance.
- reset() : void
- Reset the connection (useful for testing).
- setInstance() : void
- Set a specific PDO instance (useful for testing).
- __clone() : mixed
- Prevent cloning
- __construct() : mixed
- Prevent direct instantiation
Properties
$instance
private
static PDO|null
$instance
= \null
Singleton PDO instance
Methods
getInstance()
Get the PDO database connection instance.
public
static getInstance() : PDO
Tags
Return values
PDOreset()
Reset the connection (useful for testing).
public
static reset() : void
setInstance()
Set a specific PDO instance (useful for testing).
public
static setInstance(PDO $pdo) : void
Parameters
- $pdo : PDO
-
The PDO instance to use
__clone()
Prevent cloning
private
__clone() : mixed
__construct()
Prevent direct instantiation
private
__construct() : mixed