web-base/Core/Driver/SQL/Constraint/ForeignKey.class.php

23 lines
738 B
PHP
Raw Normal View History

2020-04-02 00:02:51 +02:00
<?php
2022-11-18 18:06:46 +01:00
namespace Core\Driver\SQL\Constraint;
2020-04-02 00:02:51 +02:00
2022-11-18 18:06:46 +01:00
use Core\Driver\SQL\Strategy\Strategy;
2020-04-03 17:39:58 +02:00
2020-04-02 00:02:51 +02:00
class ForeignKey extends Constraint {
2020-04-03 17:39:58 +02:00
private string $referencedTable;
private string $referencedColumn;
private ?Strategy $strategy;
2020-04-02 00:02:51 +02:00
2022-11-18 18:06:46 +01:00
public function __construct(string $columnName, string $refTable, string $refColumn, ?Strategy $strategy = NULL) {
parent::__construct($columnName);
2020-04-02 00:02:51 +02:00
$this->referencedTable = $refTable;
$this->referencedColumn = $refColumn;
$this->strategy = $strategy;
}
2021-04-02 21:58:06 +02:00
public function getReferencedTable(): string { return $this->referencedTable; }
public function getReferencedColumn(): string { return $this->referencedColumn; }
public function onDelete(): ?Strategy { return $this->strategy; }
2020-04-03 17:39:58 +02:00
}