Database
extends Connection
in package
Database class
This class is responsible for connecting to the database and running migrations.
Tags
Table of Contents
Properties
- $pdo : PDO
- The PDO instance for the database connection.
- $smartConnection : Database
- The SmartConnection instance for the database connection.
- $appConfig : array<string|int, mixed>
- $autoTranslateTypes : bool
- $config : array<string|int, mixed>
- The configuration for the database connection.
- $migrations : Migrations
- $tablePrefix : string
- $typeMap : array<string, string>
Methods
- __construct() : mixed
- Constructs a new Database object.
- __get() : mixed
- Magic getter method that provides dynamic access to properties with lazy loading
- attributesToAutoBindsComparisonsProperty() : QueryBuilder
- Builds WHERE clauses in a QueryBuilder using provided attributes and their comparisons
- attributesToAutoBindsOtherwisesProperty() : QueryBuilder
- Builds OR conditions in a QueryBuilder using provided attributes
- attributesToBindsComparisonsProperty() : array<string|int, mixed>
- Creates a comparison-based bind parameters array for SQL WHERE clauses
- attributesToBindsOtherwisesProperty() : array<string|int, mixed>
- Creates a comparison-based bind parameters array for "other" or "otherwise" conditions
- attributesToBindsProperty() : array<string|int, mixed>
- Converts an array of attributes into a bind parameters array with optional comparison prefix
- bindValuesToProperty() : array<string|int, mixed>
- Binds an array of property names to their corresponding values by creating a new array with property names as keys and provided values as values.
- boot() : static
- Initializes the database connection with application configuration
- columnNameToProperty() : array<string|int, mixed>
- Convert a column name to a property name.
- convertToDatabaseValue() : mixed
- Converts a value from its PHP representation to its database representation
- convertToPhpValue() : mixed
- Converts a value from its database representation to its PHP representation
- deleteFrom() : QueryBuilder
- Prepares a DELETE query builder for a specific table
- enableAutoTypeTranslation() : static
- Enables or disables automatic type translation for database operations
- filterIgnoredTypes() : array<string|int, mixed>
- Filters out attributes and their types that are marked for ignoring
- fromAppConfig() : static
- Creates a new database connection instance from application configuration
- fromExistingPdo() : Database
- Creates a Database instance from an existing PDO connection
- getAppConfig() : array<string|int, mixed>
- Retrieves the current application configuration
- getConfig() : array<string|int, mixed>
- Retrieves the current configuration array
- getTablePrefix() : string
- Retrieves the current table prefix value
- insertInto() : QueryBuilder
- Prepares an INSERT query builder for a specific table
- isAutoTypeTranslationEnabled() : bool
- Checks if automatic type translation is currently enabled
- mapColumnFromTypes() : array<string|int, mixed>
- Maps column definitions from type specifications by enhancing SQL-style column definitions
- normalizeAttributes() : array<string|int, mixed>
- Normalizes an array of attributes by either returning the attribute value directly or retrieving it from the original attributes array if it's an integer key.
- prioritizeTheMoppingArrayOfTypes() : array<string|int, mixed>
- Prioritizes and extracts specific elements from arrays of type definitions
- propertyToColumnName() : array<string|int, mixed>
- Convert a property name to a column name.
- qb() : QueryBuilder
- Creates and returns a new QueryBuilder instance
- quoteIdentifier() : string
- Quotes a single identifier for use in SQL queries
- registerPhpTypeMap() : static
- Registers a mapping between a PHP class or scalar type and a database abstraction layer type
- resolveKeys() : array<string|int, mixed>
- Retrieves identifiers from an array regardless of the format used.
- selectFrom() : QueryBuilder
- Prepares a SELECT query builder for a specific table
- setTablePrefix() : static
- Sets a new table prefix value and returns the instance for method chaining
- switchDatabase() : static
- Returns a new instance with overridden DB params.
- table() : string
- Generates a qualified table name with optional prefix handling
- tableAlias() : array<string|int, mixed>
- Creates an associative array with table name and alias for use in queries
- transactionalFast() : mixed
- Executes a callback within a database transaction context
- translateRowToPhp() : array<string|int, mixed>
- Translates database row values to their PHP representation based on expected result types
- updateTable() : QueryBuilder
- Prepares an UPDATE query builder for a specific table
Properties
$pdo
The PDO instance for the database connection.
public
PDO
$pdo
$smartConnection
The SmartConnection instance for the database connection.
public
Database
$smartConnection
$appConfig
private
array<string|int, mixed>
$appConfig
= []
$autoTranslateTypes
private
bool
$autoTranslateTypes
= true
$config
The configuration for the database connection.
private
array<string|int, mixed>
$config
$migrations
private
Migrations
$migrations
$tablePrefix
private
string
$tablePrefix
= ''
$typeMap
private
array<string, string>
$typeMap
= ['datetime' => 'datetime_immutable', 'datetimeimmutable' => 'datetime_immutable', 'date' => 'date_immutable', 'dateimmutable' => 'date_immutable', 'time' => 'time_immutable', 'timeimmutable' => 'time_immutable', 'json' => 'json', 'array' => 'json', 'bool' => 'boolean', 'boolean' => 'boolean', 'int' => 'integer', 'integer' => 'integer', 'float' => 'float', 'double' => 'float', 'string' => 'string', 'guid' => 'guid', 'uuid' => 'guid', 'ulid' => 'guid']
Methods
__construct()
Constructs a new Database object.
public
__construct(DateTime|array<string|int, mixed> $datetime[, array<string|int, mixed> $dbConfig = [] ][, Configuration|null $config = null ]) : mixed
This object is responsible for connecting to the database and running migrations.
Parameters
- $datetime : DateTime|array<string|int, mixed>
- $dbConfig : array<string|int, mixed> = []
-
The configuration for the database connection. The configuration should contain the following keys:
- dsn: The DSN for the database connection.
- user: The username for the database connection.
- password: The password for the database connection.
- $config : Configuration|null = null
__get()
Magic getter method that provides dynamic access to properties with lazy loading
public
__get(string $name) : mixed
This public method implements the __get magic method to create and return specific objects or values when certain property names are accessed. It acts as a simple factory or proxy method for commonly used database operations.
The method handles these special cases:
- 'bulider', 'build', 'sql', 'query' all return the same QueryBuilder instance
- Any other property returns null by default
This pattern is useful for creating convenient aliases to frequently used objects without requiring explicit property declarations or complex getter logic.
Parameters
- $name : string
-
The name of the property being accessed
Return values
mixed —Returns either a QueryBuilder instance, connection object, or null
attributesToAutoBindsComparisonsProperty()
Builds WHERE clauses in a QueryBuilder using provided attributes and their comparisons
public
attributesToAutoBindsComparisonsProperty(QueryBuilder $qb, array<string|int, mixed> $attributes) : QueryBuilder
This method takes an existing QueryBuilder instance and appends WHERE conditions to it, handling the first condition as a simple WHERE and subsequent ones as AND conditions. It's designed to build complex WHERE clauses programmatically from attribute arrays.
Parameters
- $qb : QueryBuilder
-
The QueryBuilder instance to modify
- $attributes : array<string|int, mixed>
-
Array of attributes to use in WHERE conditions
Return values
QueryBuilder —Returns the modified QueryBuilder instance for chaining
attributesToAutoBindsOtherwisesProperty()
Builds OR conditions in a QueryBuilder using provided attributes
public
attributesToAutoBindsOtherwisesProperty(QueryBuilder $qb, array<string|int, mixed> $attributes) : QueryBuilder
This method takes an existing QueryBuilder instance and appends OR conditions to it, handling the first condition as an OR clause and subsequent ones as additional OR conditions. It's designed for building flexible WHERE clauses with OR logic.
Parameters
- $qb : QueryBuilder
-
The QueryBuilder instance to modify
- $attributes : array<string|int, mixed>
-
Array of attributes to use in OR conditions
Return values
QueryBuilder —Returns the modified QueryBuilder instance for chaining
attributesToBindsComparisonsProperty()
Creates a comparison-based bind parameters array for SQL WHERE clauses
public
attributesToBindsComparisonsProperty(array<string|int, mixed> $attributes) : array<string|int, mixed>
This method generates bind parameters specifically for equality comparisons by:
- First calling attributesToBindsProperty to get the basic bind structure
- Then modifying each value to include the attribute name as a prefix
This is useful for building WHERE clauses where you need both the column reference and parameter placeholder (e.g., "users.id = :id").
Parameters
- $attributes : array<string|int, mixed>
-
Array of attribute names to be converted
Return values
array<string|int, mixed> —Returns an associative array with modified bind strings
attributesToBindsOtherwisesProperty()
Creates a comparison-based bind parameters array for "other" or "otherwise" conditions
public
attributesToBindsOtherwisesProperty(array<string|int, mixed> $attributes) : array<string|int, mixed>
This method generates bind parameters that combine attribute names with their comparison values without any additional prefixes. It's designed to work with OR clauses in WHERE conditions.
Parameters
- $attributes : array<string|int, mixed>
-
Array of attribute names to be processed
Return values
array<string|int, mixed> —Returns an associative array where keys and values are combined
attributesToBindsProperty()
Converts an array of attributes into a bind parameters array with optional comparison prefix
public
attributesToBindsProperty(array<string|int, mixed> $attributes[, string $comparison = "" ]) : array<string|int, mixed>
This public method takes an array of attribute names and creates a new associative array where each key is an attribute name and each value is a string in the format: "$comparison:{attribute_name}" (e.g., " = :username").
Parameters
- $attributes : array<string|int, mixed>
-
Array of attribute names to be converted
- $comparison : string = ""
-
Optional comparison operator to prefix (default: "")
Return values
array<string|int, mixed> —Returns an associative array with attributes as keys and formatted bind strings as values
bindValuesToProperty()
Binds an array of property names to their corresponding values by creating a new array with property names as keys and provided values as values.
public
bindValuesToProperty(array<string|int, mixed> $bindProperty, array<string|int, mixed> $values) : array<string|int, mixed>
This method takes a keyed array of properties and an array of values, then combines them into a new associative array where each property name is paired with its corresponding value based on their position in the original arrays. It's commonly used for mapping data to class properties or preparing data for database operations.
Parameters
- $bindProperty : array<string|int, mixed>
-
Associative array of property names and their values
- $values : array<string|int, mixed>
-
Array of values to be bound to properties
Return values
array<string|int, mixed> —Returns a new associative array with property names as keys and values as values
boot()
Initializes the database connection with application configuration
public
boot(array<string|int, mixed> $appConfig) : static
This public method bootstraps the database connection by:
- Storing the application configuration for future reference
- Setting up table prefix from config or defaulting to empty string
- Configuring auto-translation of types based on config or defaulting to true
- Merging any type mappings from configuration with existing type maps
Parameters
- $appConfig : array<string|int, mixed>
-
The application configuration to use for initialization
Return values
static —Returns $this to allow for method chaining
columnNameToProperty()
Convert a column name to a property name.
public
columnNameToProperty(array<string|int, mixed> $input) : array<string|int, mixed>
This method will take a column name (e.g. "user_name") and convert it to a property name (e.g. "userName").
Parameters
- $input : array<string|int, mixed>
-
The column name to convert.
Return values
array<string|int, mixed> —The property name.
convertToDatabaseValue()
Converts a value from its PHP representation to its database representation
public
convertToDatabaseValue(mixed $value, string $type) : mixed
This public method handles the conversion of values between PHP space and database space. It's particularly useful when working with custom data types where special conversion logic is required. The method checks if the type exists in Doctrine's Type system before attempting conversion.
Parameters
- $value : mixed
-
The value to be converted
- $type : string
-
The database type to convert to
Return values
mixed —Returns the converted value or original value if type doesn't exist
convertToPhpValue()
Converts a value from its database representation to its PHP representation
public
convertToPhpValue(mixed $value, string $type) : mixed
This public method handles the conversion of values from the database back to PHP space. It's used when retrieving data from the database and needs to be properly typed or formatted according to the application's requirements. The method validates the existence of the type before attempting conversion.
Parameters
- $value : mixed
-
The value to be converted from database format
- $type : string
-
The PHP type to convert from
Return values
mixed —Returns the converted value or original value if type doesn't exist
deleteFrom()
Prepares a DELETE query builder for a specific table
public
deleteFrom(string $table[, string|null $prefixOverride = null ]) : QueryBuilder
This public method creates a DELETE query builder configured with the specified table name. It's designed to simplify the process of building DELETE statements by setting up the proper table context and returning a ready-to-use QueryBuilder.
Parameters
- $table : string
-
The table name to delete from
- $prefixOverride : string|null = null
-
Optional custom prefix to use instead of default
Return values
QueryBuilder —Returns a configured QueryBuilder instance for DELETE operations
enableAutoTypeTranslation()
Enables or disables automatic type translation for database operations
public
enableAutoTypeTranslation([bool $enabled = true ]) : static
This public method controls whether the system should automatically translate types when performing database operations. This is particularly useful for handling different data type mappings between databases.
Parameters
- $enabled : bool = true
-
Whether to enable (true) or disable (false) auto-type translation
Return values
static —Returns $this to allow for method chaining
filterIgnoredTypes()
Filters out attributes and their types that are marked for ignoring
public
static filterIgnoredTypes(array<string|int, mixed> $attributes, array<string|int, mixed> $attributesTypes) : array<string|int, mixed>
This public static method takes two arrays - one containing attribute names and their values, and another containing corresponding type information. It filters out any attributes that have "ignore" in their type definition or are null, returning a merged array of the filtered results.
The method performs two main filtering operations:
- Filters the $attributesTypes array to exclude types containing "ignore" or being null
- Filters the $attributes array to exclude keys where the corresponding type is ignored or null
This is particularly useful in data mapping scenarios where certain fields should be excluded from processing based on their ignore flags, such as when generating database queries or API responses.
Parameters
- $attributes : array<string|int, mixed>
-
Associative array of attribute names and their values
- $attributesTypes : array<string|int, mixed>
-
Array mapping attribute names to their type definitions
Return values
array<string|int, mixed> —Returns a merged array with ignored types filtered out
fromAppConfig()
Creates a new database connection instance from application configuration
public
static fromAppConfig(array<string|int, mixed> $config) : static
This public static method serves as a factory method for creating database connection instances. It takes a configuration array and uses it to establish a connection with the appropriate database driver, then boots the connection with the provided config.
Parameters
- $config : array<string|int, mixed>
-
The application configuration containing database settings
Return values
static —Returns a new instance of the current class with the configuration applied
fromExistingPdo()
Creates a Database instance from an existing PDO connection
public
static fromExistingPdo(PDO $pdo) : Database
This public static method creates and configures a Database instance using an existing PDO connection object. It detects the appropriate database driver based on the PDO's attribute settings and sets up the connection properly.
Parameters
- $pdo : PDO
-
The existing PDO connection to use
Tags
Return values
Database —Returns a new Database instance configured with the provided PDO
getAppConfig()
Retrieves the current application configuration
public
getAppConfig() : array<string|int, mixed>
This public method returns the stored application configuration array that was used to initialize the database connection. It provides access to all configuration values that were set during bootstrapping.
Return values
array<string|int, mixed> —Returns the current application configuration
getConfig()
Retrieves the current configuration array
public
getConfig() : array<string|int, mixed>
This public method returns the internal configuration array that contains all the configuration settings for this database connection. The configuration typically includes database connection parameters, table prefixes, type mappings, and other environment-specific settings.
Return values
array<string|int, mixed> —Returns the complete configuration array
getTablePrefix()
Retrieves the current table prefix value
public
getTablePrefix() : string
This public method returns the table prefix that is currently configured for this connection. The table prefix is used to namespace tables in the database and prevent naming conflicts.
Return values
string —Returns the current table prefix as a string
insertInto()
Prepares an INSERT query builder for a specific table
public
insertInto(string $table[, string|null $prefixOverride = null ]) : QueryBuilder
This public method creates an INSERT query builder configured with the specified table name. It's designed to simplify the process of building INSERT statements by setting up the proper table context and returning a ready-to-use QueryBuilder.
Parameters
- $table : string
-
The table name to insert into
- $prefixOverride : string|null = null
-
Optional custom prefix to use instead of default
Return values
QueryBuilder —Returns a configured QueryBuilder instance for INSERT operations
isAutoTypeTranslationEnabled()
Checks if automatic type translation is currently enabled
public
isAutoTypeTranslationEnabled() : bool
This public method returns the current state of the auto-type translation setting. It's used internally by the system to determine whether to apply type conversions during database operations.
Return values
bool —Returns true if auto-type translation is enabled, false otherwise
mapColumnFromTypes()
Maps column definitions from type specifications by enhancing SQL-style column definitions
public
mapColumnFromTypes(array<string|int, mixed> $attributes, array<string|int, mixed> $attributesTypes) : array<string|int, mixed>
This public method takes attribute definitions and enhances them with SQL-specific formatting by prefixing certain column types with "sql_" and applying proper SQL syntax. It's designed to process attributes that have SQL column type specifications and format them accordingly.
The method:
- Filters the attributesTypes array to find entries that start with 'sql_' prefix
- For each matching attribute, it processes the value to remove the 'sql_' prefix
- Converts the remaining part to uppercase
- Wraps the original attribute value in parentheses
- Appends an alias using the original attribute name
This is particularly useful for database schema generation where you need to format column definitions with proper SQL syntax and aliases.
Parameters
- $attributes : array<string|int, mixed>
-
Associative array of attribute names and their values
- $attributesTypes : array<string|int, mixed>
-
Array of attribute type definitions that may contain SQL prefixes
Return values
array<string|int, mixed> —Returns the modified attributes array with enhanced SQL column definitions
normalizeAttributes()
Normalizes an array of attributes by either returning the attribute value directly or retrieving it from the original attributes array if it's an integer key.
public
normalizeAttributes(array<string|int, mixed> $attributes) : array<string|int, mixed>
This method processes an array of attributes and handles two cases:
- When the attribute is not an integer, returns it as-is
- When the attribute is an integer, treats it as an index and retrieves the corresponding value from the original attributes array
This pattern is useful when working with mixed arrays where some elements are indices and others are actual attribute names, allowing for flexible attribute handling.
Parameters
- $attributes : array<string|int, mixed>
-
The original array of attributes to reference
Return values
array<string|int, mixed> —Returns a new array with normalized attributes
prioritizeTheMoppingArrayOfTypes()
Prioritizes and extracts specific elements from arrays of type definitions
public
static prioritizeTheMoppingArrayOfTypes(array<string|int, mixed> $attributesTypes[, bool $getEnd = false ]) : array<string|int, mixed>
This public static method processes an array of attribute types and extracts either the first element or second element (if available) from each array value, depending on the getEnd parameter. It's designed to handle nested arrays of type information and extract the most relevant type specification.
The method is particularly useful in scenarios where multiple type options exist for a property and you need to select the appropriate one based the $getEnd flag:
- When $getEnd is false (default): Returns the first element of each array (index 0)
- When $getEnd is true: Returns the second element of each array (index 1), if it exists
Parameters
- $attributesTypes : array<string|int, mixed>
-
Array of attribute type definitions (can contain nested arrays)
- $getEnd : bool = false
-
If true, returns the second element of arrays; if false, returns the first element
Return values
array<string|int, mixed> —Returns a new array with processed type information
propertyToColumnName()
Convert a property name to a column name.
public
propertyToColumnName(array<string|int, mixed> $propertyName) : array<string|int, mixed>
This method will take a property name (e.g. "userName") and convert it to a column name (e.g. "user_name").
Parameters
- $propertyName : array<string|int, mixed>
-
The property name to convert.
Return values
array<string|int, mixed> —The column name.
qb()
Creates and returns a new QueryBuilder instance
public
qb() : QueryBuilder
This public method provides a convenient way to get a configured QueryBuilder instance for building database queries. It leverages the existing connection configuration and ensures proper query building capabilities.
Return values
QueryBuilder —Returns a new QueryBuilder instance
quoteIdentifier()
Quotes a single identifier for use in SQL queries
public
quoteIdentifier(string $identifier) : string
This public method properly escapes and quotes an identifier (such as table names, column names, or database names) to ensure it's safe for use in SQL statements. It's part of the database abstraction layer's identifier handling capabilities.
Parameters
- $identifier : string
-
The identifier to be quoted
Return values
string —Returns the properly quoted identifier
registerPhpTypeMap()
Registers a mapping between a PHP class or scalar type and a database abstraction layer type
public
registerPhpTypeMap(string $phpClassOrScalar, string $dbalType) : static
This public method allows for custom type mappings to be defined, enabling the system to automatically handle conversion between specific PHP types and their database representations. It's particularly useful when working with custom data types or when extending existing type systems with new mapping capabilities.
Parameters
- $phpClassOrScalar : string
-
The PHP class name or scalar type to map
- $dbalType : string
-
The database abstraction layer type name
Return values
static —Returns self for method chaining
resolveKeys()
Retrieves identifiers from an array regardless of the format used.
public
resolveKeys(array<string|int, mixed> $input) : array<string|int, mixed>
If the key is a string -> takes the key. If the key is a number (auto-incremented) -> takes the value.
Parameters
- $input : array<string|int, mixed>
-
Mixed array, e.g. ["cosMod" => "table", "obdS"]
Return values
array<string|int, mixed> —Extracted identifiers: ["cosMod", "obdS"]
selectFrom()
Prepares a SELECT query builder for a specific table
public
selectFrom(string $table[, array<string|int, mixed>|string $columns = ['*'] ][, string|null $alias = null ][, string|null $prefixOverride = null ]) : QueryBuilder
This public method creates a SELECT query builder configured with the specified table, columns, and optional alias. It's designed to simplify the most common database read operations by providing a standardized way to start SELECT queries.
Parameters
- $table : string
-
The table name to select from
- $columns : array<string|int, mixed>|string = ['*']
-
The column(s) to select (default: all columns)
- $alias : string|null = null
-
Optional alias for the table
- $prefixOverride : string|null = null
-
Optional custom prefix to use instead of default
Return values
QueryBuilder —Returns a configured QueryBuilder instance
setTablePrefix()
Sets a new table prefix value and returns the instance for method chaining
public
setTablePrefix(string $prefix) : static
This public method allows for dynamically changing the table prefix after object initialization. It's useful when you need to switch between different database schemas or namespaces.
Parameters
- $prefix : string
-
The new table prefix to use
Return values
static —Returns $this to allow for method chaining
switchDatabase()
Returns a new instance with overridden DB params.
public
switchDatabase(array<string|int, mixed> $overrideParams) : static
Creates a new instance with overridden database configuration parameters
This public method allows for temporary switching of database configurations by creating a new instance with modified parameters while preserving the original instance. It's particularly useful for:
- Testing database connections with different credentials
- Switching between multiple databases dynamically
- Applying environment-specific overrides
- Creating temporary configuration changes
The method works by:
- Retrieving the current application configuration
- Merging it with override parameters using array_replace_recursive
- Creating a new instance with the merged configuration
- Returning the newly created instance with the updated configuration
Parameters
- $overrideParams : array<string|int, mixed>
-
An associative array of configuration parameters to override
Return values
static —Returns a new instance of the current class with the merged configuration
table()
Generates a qualified table name with optional prefix handling
public
table(string $tableName[, string|null $prefixOverride = null ]) : string
This public method takes a table name and appends the appropriate prefix based on the current configuration. It ensures that table names are properly namespaced and handles edge cases like empty prefixes or already-prefixed table names.
Parameters
- $tableName : string
-
The original table name
- $prefixOverride : string|null = null
-
Optional custom prefix to use instead of default
Return values
string —Returns the fully qualified table name with prefix
tableAlias()
Creates an associative array with table name and alias for use in queries
public
tableAlias(string $tableName, string $alias[, string|null $prefixOverride = null ]) : array<string|int, mixed>
This public method generates a standardized array containing both the processed table name (with proper prefixing) and an alias. It's particularly useful when building complex queries that require both table references and aliases.
Parameters
- $tableName : string
-
The original table name to be aliased
- $alias : string
-
The alias to associate with the table
- $prefixOverride : string|null = null
-
Optional custom prefix to use instead of default
Return values
array<string|int, mixed> —Returns an associative array with 'table' and 'alias' keys
transactionalFast()
Executes a callback within a database transaction context
public
transactionalFast(callable $callback) : mixed
This public method provides a convenient way to execute database operations within a transactional context. It delegates the actual transaction handling to the underlying transactional method, providing a clean interface for executing multiple database operations that should either all succeed or all fail.
Parameters
- $callback : callable
-
The callback function to execute within the transaction
Return values
mixed —Returns the result of the callback execution
translateRowToPhp()
Translates database row values to their PHP representation based on expected result types
public
translateRowToPhp(array<string|int, mixed> $row, array<string|int, mixed> $resultTypes) : array<string|int, mixed>
This public method processes a row of data by converting each column's value from its database representation to the appropriate PHP type as specified in the resultTypes mapping. It's particularly useful when working with custom result sets where columns may need special handling based on their expected PHP types.
Parameters
- $row : array<string|int, mixed>
-
The row of data to be translated
- $resultTypes : array<string|int, mixed>
-
An array mapping column names to their expected PHP types
Return values
array<string|int, mixed> —Returns the translated row with properly typed values
updateTable()
Prepares an UPDATE query builder for a specific table
public
updateTable(string $table[, string|null $prefixOverride = null ]) : QueryBuilder
This public method creates an UPDATE query builder configured with the specified table name. It's designed to simplify the process of building UPDATE statements by setting up the proper table context and returning a ready-to-use QueryBuilder.
Parameters
- $table : string
-
The table name to update
- $prefixOverride : string|null = null
-
Optional custom prefix to use instead of default
Return values
QueryBuilder —Returns a configured QueryBuilder instance for UPDATE operations