2020-04-02 00:02:51 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Driver\SQL\Constraint;
|
|
|
|
|
2020-04-03 17:39:58 +02:00
|
|
|
use Driver\SQL\Strategy\Strategy;
|
|
|
|
|
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
|
|
|
|
|
|
|
public function __construct($name, $refTable, $refColumn, $strategy = NULL) {
|
|
|
|
parent::__construct($name);
|
|
|
|
$this->referencedTable = $refTable;
|
|
|
|
$this->referencedColumn = $refColumn;
|
|
|
|
$this->strategy = $strategy;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getReferencedTable() { return $this->referencedTable; }
|
|
|
|
public function getReferencedColumn() { return $this->referencedColumn; }
|
|
|
|
public function onDelete() { return $this->strategy; }
|
2020-04-03 17:39:58 +02:00
|
|
|
}
|