WP-Query-Builder/interfaces/DatabaseHelper.php
2025-01-27 19:35:17 +01:00

59 lines
2.3 KiB
PHP

<?php
namespace DatabaseHelper\interfaces;
interface DatabaseHelper
{
/**
* Initializes a Table instance to represent a database table.
* This instance can be used to define and finalĺy create database tables.
*
* @param string $tableName The name of the table.
* @return TableBlueprint Generated Table instance.
*/
public static function makeTable(string $tableName): TableBlueprint;
/**
* Initializes a Migration instance for managing database migrations for the specified table.
*
* @param TableBlueprint $table The table for which the migration is being created.
* @return MigrationBlueprint Generated Migration instance.
*/
public static function makeMigration(TableBlueprint $table): MigrationBlueprint;
/**
* Initializes a Query instance to perform operations on the specified tables.
* When multiple tables are provided, they will be joined automatically for the query.
*
* @param TableBlueprint ...$tables One or more Table instances.
* @return QueryBuilder Generated Query instance.
*/
public static function makeQuery(TableBlueprint ...$tables): QueryBuilder;
/**
* Initializes a Query instance specifically for inserting data into the specified tables.
* When multiple tables are provided, they will be joined automatically for the insertion.
*
* @param TableBlueprint ...$tables One or more Table instances.
* @return QueryBuilder Generated Query instance.
*/
public static function makeInsertion(TableBlueprint ...$tables): QueryBuilder;
/**
* Initializes an Update instance to perform updates on the specified tables.
* When multiple tables are provided, they will be joined automatically.
*
* @param TableBlueprint ...$tables One or more Table instances.
* @return UpdateBuilder Generated Update instance.
*/
public static function makeUpdate(TableBlueprint ...$tables): UpdateBuilder;
/**
* Standardizes table names by ensuring they include the WordPress database prefix.
* If the prefix is not already present, it will be added.
* The provided name(s) are passed by reference and will be modified directly.
*
* @param string &...$tableName The table names to standardize.
*/
public static function standardizeTableNames(string &...$tableName): void;
}