Namespace and ClassPath rewrites

This commit is contained in:
2022-11-18 18:06:46 +01:00
parent c277aababc
commit 951ff14c5f
217 changed files with 1017 additions and 936 deletions

View File

@@ -0,0 +1,18 @@
<?php
namespace Core\Driver\SQL\Constraint;
abstract class Constraint {
private array $columnNames;
private ?string $name;
public function __construct($columnNames, ?string $constraintName = NULL) {
$this->columnNames = (!is_array($columnNames) ? array($columnNames) : $columnNames);
$this->name = $constraintName;
}
public function getColumnNames(): array { return $this->columnNames; }
public function getName(): ?string { return $this->name; }
public function setName(string $name) { $this->name = $name; }
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Core\Driver\SQL\Constraint;
use Core\Driver\SQL\Strategy\Strategy;
class ForeignKey extends Constraint {
private string $referencedTable;
private string $referencedColumn;
private ?Strategy $strategy;
public function __construct(string $columnName, string $refTable, string $refColumn, ?Strategy $strategy = NULL) {
parent::__construct($columnName);
$this->referencedTable = $refTable;
$this->referencedColumn = $refColumn;
$this->strategy = $strategy;
}
public function getReferencedTable(): string { return $this->referencedTable; }
public function getReferencedColumn(): string { return $this->referencedColumn; }
public function onDelete(): ?Strategy { return $this->strategy; }
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Core\Driver\SQL\Constraint;
class PrimaryKey extends Constraint {
public function __construct(...$names) {
parent::__construct((!empty($names) && is_array($names[0])) ? $names[0] : $names);
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Core\Driver\SQL\Constraint;
class Unique extends Constraint {
public function __construct(...$names) {
parent::__construct((!empty($names) && is_array($names[0])) ? $names[0] : $names);
}
}