WP-Query-Builder/interfaces/DatabaseHelper.php

59 lines
2.3 KiB
PHP
Raw Normal View History

2025-01-24 13:26:48 +01:00
<?php
namespace DatabaseHelper\interfaces;
2025-01-27 19:35:17 +01:00
interface DatabaseHelper
2025-01-24 13:26:48 +01:00
{
/**
* 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.
2025-01-27 19:35:17 +01:00
* @return TableBlueprint Generated Table instance.
2025-01-24 13:26:48 +01:00
*/
2025-01-27 19:35:17 +01:00
public static function makeTable(string $tableName): TableBlueprint;
2025-01-24 13:26:48 +01:00
/**
* Initializes a Migration instance for managing database migrations for the specified table.
*
2025-01-27 19:35:17 +01:00
* @param TableBlueprint $table The table for which the migration is being created.
* @return MigrationBlueprint Generated Migration instance.
2025-01-24 13:26:48 +01:00
*/
2025-01-27 19:35:17 +01:00
public static function makeMigration(TableBlueprint $table): MigrationBlueprint;
2025-01-24 13:26:48 +01:00
/**
* Initializes a Query instance to perform operations on the specified tables.
* When multiple tables are provided, they will be joined automatically for the query.
*
2025-01-27 19:35:17 +01:00
* @param TableBlueprint ...$tables One or more Table instances.
* @return QueryBuilder Generated Query instance.
2025-01-24 13:26:48 +01:00
*/
2025-01-27 19:35:17 +01:00
public static function makeQuery(TableBlueprint ...$tables): QueryBuilder;
2025-01-24 13:26:48 +01:00
/**
* 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.
*
2025-01-27 19:35:17 +01:00
* @param TableBlueprint ...$tables One or more Table instances.
* @return QueryBuilder Generated Query instance.
2025-01-24 13:26:48 +01:00
*/
2025-01-27 19:35:17 +01:00
public static function makeInsertion(TableBlueprint ...$tables): QueryBuilder;
2025-01-24 13:26:48 +01:00
/**
* Initializes an Update instance to perform updates on the specified tables.
* When multiple tables are provided, they will be joined automatically.
*
2025-01-27 19:35:17 +01:00
* @param TableBlueprint ...$tables One or more Table instances.
* @return UpdateBuilder Generated Update instance.
2025-01-24 13:26:48 +01:00
*/
2025-01-27 19:35:17 +01:00
public static function makeUpdate(TableBlueprint ...$tables): UpdateBuilder;
2025-01-24 13:26:48 +01:00
/**
* 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.
*/
2025-01-27 19:35:17 +01:00
public static function standardizeTableNames(string &...$tableName): void;
2025-01-24 13:26:48 +01:00
}