Documentation

DatabaseTrait

This trait attaches a Database singleton to the user of the Trait. The key method is ::getDb() which returns a database object

The DatabaseTrait gives access to a global singleton database object via the static method 'getDb()' for all database queries. This way we don't waste resources and time spinning up a new object every call. Furthermore, we can profile ALL queries made in the system, and cache queries that are repetitive.

Table of Contents

Properties

$error_message  : string

Methods

configErrorMessage()  : string
Returns the configuration error message.
getConfig()  : TiqConfig
Gets the TIQ configuration.
getDb()  : PgSQL
Gets database instance.
isDebug()  : bool
Is debug mode or not.

Properties

$error_message

public static string $error_message = 'An issue occurred, please contact ThinkIQ for Support and enable debugging'
  • Base error message

Methods

configErrorMessage()

Returns the configuration error message.

public static configErrorMessage() : string
Return values
string

getConfig()

Gets the TIQ configuration.

public static getConfig() : TiqConfig
Return values
TiqConfig

getDb()

Gets database instance.

public static getDb() : PgSQL

The database connection is stored in a static property within the DatabaseConnectionManager class, ensuring that it is truly a singleton across the entire application, regardless of which class calls this method.

Return values
PgSQL

isDebug()

Is debug mode or not.

public static isDebug() : bool
Return values
bool

        
On this page

Search results