Skip to content

Internals Database Creator Table TableSchemaProvider

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

database\creator\table\TableSchemaProvider

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/database/creator/table/TableSchemaProvider.php · Snapshot 8411f4287706.

DatabaseManager delegates SQL generation to QueryBuilder, execution to IProvider, and result caching to ICache. Schema builders use MySQL DDL and the framework table registry.

Imports and dependencies

use database\creator\interface\ITableSchemaProvider;
use database\interface\IProvider;

TableSchemaProvider

Declaration and architectural role

class TableSchemaProvider implements ITableSchemaProvider

Source description (behavioral corrections are recorded in Known discrepancies):

TableSchemaProvider

Executes DDL statements (CREATE TABLE, ALTER TABLE, DROP TABLE, CREATE INDEX, DROP INDEX) against the database by delegating to IProvider.

DDL statements are passed as complete SQL strings with no PDO bindings. IProvider::execute() accepts an empty bindings array for this purpose.

This class never constructs SQL itself; that is TableWizard's responsibility. It only receives a finished SQL string and runs it.

Constants, enum cases, traits and properties

Declarations below preserve visibility, type, default and modifiers exactly. A typed property without an initializer remains uninitialized until its constructor or another method assigns it. Mutable fields belong to this instance unless marked static; readonly fields can be initialized once. Constructor-promoted properties are also listed below.

Member Declaration Purpose or source contract
Constructor-promoted private readonly IProvider $provider Initialized from the constructor argument; default expression is evaluated when the argument is omitted.

Method index

Method Signature
__construct public function __construct( private readonly IProvider $provider, )
executeDDL public function executeDDL(string $sql): bool

__construct

Source line 25

public function __construct(
        private readonly IProvider $provider,
    );

Parameters

Parameter Type, modifiers and default Purpose
$provider private readonly IProvider $provider The database execution provider.

@param IProvider $provider The database execution provider.

Concrete no-op/default hook: this method performs no work. Override it where the lifecycle or extension contract calls for behavior.

executeDDL

Source line 35

public function executeDDL(string $sql): bool

Parameters

Parameter Type, modifiers and default Purpose
$sql string $sql Operation input; the exact use, validation and propagation are shown in the implementation trace.

{@inheritdoc}

The statement is executed with an empty bindings array because DDL never uses parameterised placeholders.

Return expressions (including local callbacks): true.

Implementation, validation guards and interaction order
/**
     * {@inheritdoc}
     *
     * The statement is executed with an empty bindings array because DDL
     * never uses parameterised placeholders.
     */
    public function executeDDL(string $sql): bool
    {
        $stmt = $this->provider->execute($sql, []);
        $stmt->closeCursor();
        return true;
    }

Related types

Clone this wiki locally