Connection
in package
Connection class for establishing a PDO database connection.
The Connection class provides a static method to obtain a PDO instance for interacting with the database. It uses environment variables to configure the connection parameters.
Tags
Table of Contents
- $_db : PDO|null
- commitTransaction() : void
- Commit the current transaction.
- get() : PDO
- Get a PDO instance for the database connection.
- initTransaction() : bool
- Begin a transaction.
- rollbackTransaction() : void
- Roll back the current transaction.
- __clone() : mixed
- Connection clone method.
- __construct() : mixed
- Connection constructor.
Properties
$_db
private
static PDO|null
$_db
= null
The PDO instance for the database connection.
Methods
commitTransaction()
Commit the current transaction.
public
static commitTransaction() : void
Tags
Return values
void —get()
Get a PDO instance for the database connection.
public
static get() : PDO
Tags
Return values
PDO —A PDO instance for the database connection.
initTransaction()
Begin a transaction.
public
static initTransaction() : bool
Tags
Return values
bool —True if the transaction was started, false if a transaction is already in progress.
rollbackTransaction()
Roll back the current transaction.
public
static rollbackTransaction() : void
Tags
Return values
void —__clone()
Connection clone method.
private
__clone() : mixed
This method is private to prevent cloning of this class.
Return values
mixed —__construct()
Connection constructor.
private
__construct() : mixed
This constructor is private to prevent instantiation of this class.