classReferentialAction
final class ReferentialAction
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.One ON UPDATE or ON DELETE clause of a foreign key.
Mirrors fk_upd_action/fk_del_action with fk_del_set_cols: SET NULL and SET DEFAULT may name the columns they set. The server accepts such a column list only for ON DELETE, which is a diagnostic of the constraint. Source: https://www.postgresql.org/docs/17/sql-createtable.html#SQL-CREATETABLE-PARMS-REFERENCES.
$create = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE TABLE t (a int, b int, FOREIGN KEY (a, b) REFERENCES u ON DELETE SET NULL (b))');
$create->statement->definition->elements[2]->actions[0]->columns[0]->value // => 'b'new \SqlSemantics\Platform\PostgreSql\Statement\Constraint\Reference\ReferentialAction(\SqlSemantics\Platform\PostgreSql\Statement\Constraint\Reference\ReferenceEvent::Delete, \SqlSemantics\Platform\PostgreSql\Statement\Constraint\Reference\ReferenceAction::Cascade, [new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('a')]) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstructionProperties§
public list<Name> $columnspublic ReferenceEvent $eventpublic ReferenceAction $actionMethods§
public function __construct(
public ReferenceEvent $event,
public ReferenceAction $action,
list<Name> $columns = [],
)Parameters
$event | ReferenceEvent | The change answered |
$action | ReferenceAction | The action taken |
$columns | list<Name> | The columns SET NULL or SET DEFAULT sets |
Calls 4
- static-call Check::listOf() line 45
- class-const Name::class() line 45
- static-call Check::input() line 46
- method-call ReferenceAction::setsColumns() line 46
public function render(Output $out): voidWrites ON, the event, the action and its columns.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 54
- function-call
explodeline 54 - method-call Writing::parenthesized() line 56
- new Writing line 56
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.