Repository navigation
Internals Uninstaller Cleanup TableCleanup
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/uninstaller/cleanup/TableCleanup.php · Snapshot 8411f4287706.
Uninstallation deletes the package record before attempting each cleanup collaborator. Failures are collected; cleanup continues and can leave partial state.
use database\creator\interface\ITableRegistry;
use database\creator\interface\ITableSchemaProvider;
use uninstaller\interfaces\IPackageCleanup;class TableCleanup implements IPackageCleanupDeclarations 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 ITableRegistry $registry |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | private readonly ITableSchemaProvider $schema |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Method | Signature |
|---|---|
| __construct | public function __construct( private readonly ITableRegistry $registry, private readonly ITableSchemaProvider $schema, ) |
| clean | public function clean(int $id, string $name): array |
public function __construct(
private readonly ITableRegistry $registry,
private readonly ITableSchemaProvider $schema,
);| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$registry |
private readonly ITableRegistry $registry |
Registration or lookup collaborator. |
$schema |
private readonly ITableSchemaProvider $schema |
DDL executor collaborator. |
Concrete no-op/default hook: this method performs no work. Override it where the lifecycle or extension contract calls for behavior.
public function clean(int $id, string $name): array| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$id |
int $id |
Record or runtime identifier selected by this operation. |
$name |
string $name |
Named key/label selected by this API; its exact scope is shown by the implementation trace. |
Return expressions (including local callbacks): array_values($pending).
Explicit exceptions: \RuntimeException. The guards in the implementation below show when each is raised; exceptions from collaborators also propagate unless caught.
Failure handling catches \Throwable.
Implementation, validation guards and interaction order
public function clean(int $id, string $name): array
{
$pending = array_fill_keys($this->registry->findByOwner($id), '');
do {
$progress = false;
foreach (array_keys($pending) as $table) {
try {
$quoted = '`' . str_replace('`', '``', $table) . '`';
// Allows retry after successful DDL but failed registry cleanup.
if (!$this->schema->executeDDL("DROP TABLE IF EXISTS {$quoted}")) {
throw new \RuntimeException('Table drop failed.');
}
$this->registry->unregisterTable($table);
unset($pending[$table]);
$progress = true;
} catch (\Throwable $error) {
$pending[$table] = "Table {$table}: " . $error->getMessage();
}
}
// Retry failed drops after referencing tables have been removed.
} while ($progress && $pending !== []);
return array_values($pending);
}AWT Framework Wiki · Home · Installation Guide · Developer Guide · Framework Internals
Philosophy · Architecture · Known discrepancies · Verification
Installation Guide
Developer Guide
- Learning sequence
- First package
- Package structure
- Lifecycle
- Runtimes
- Events and objects
- Routing and controllers
- Views and resources
- Database and models
- Storage and caching
- Configuration and CLI
- Responses and errors
- Extension points
Framework Internals
- Architecture
- Bootstrap
- Packages
- Runtime
- Events and context
- Objects
- HTTP routing and controllers
- Rendering
- Blade integration
- Database
- Models
- Storage and caching
- Settings
- CLI
- Identity and sessions
- Responses
- Errors
- Complete source inventory
Documentation notes