/var/www/vhosts/ihelp.ro/httpdocs/vendor/robmorgan/phinx/src/Phinx/Db/Action
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/robmorgan/phinx/src/Phinx/Db/Action/AddForeignKey.php (2274B)
foreignKey = $fk;
}
/**
* Creates a new AddForeignKey object after building the foreign key with
* the passed attributes
*
* @param \Phinx\Db\Table\Table $table The table object to add the foreign key to
* @param string|string[] $columns The columns for the foreign key
* @param \Phinx\Db\Table\Table|string $referencedTable The table the foreign key references
* @param string|string[] $referencedColumns The columns in the referenced table
* @param array
$options Extra options for the foreign key
* @param string|null $name The name of the foreign key
* @return static
*/
public static function build(Table $table, $columns, $referencedTable, $referencedColumns = ['id'], array $options = [], ?string $name = null)
{
if (is_string($referencedColumns)) {
$referencedColumns = [$referencedColumns]; // str to array
}
if (is_string($referencedTable)) {
$referencedTable = new Table($referencedTable);
}
$fk = new ForeignKey();
$fk->setReferencedTable($referencedTable)
->setColumns($columns)
->setReferencedColumns($referencedColumns)
->setOptions($options);
if ($name !== null) {
$fk->setConstraint($name);
}
return new static($table, $fk);
}
/**
* Returns the foreign key to be added
*
* @return \Phinx\Db\Table\ForeignKey
*/
public function getForeignKey(): ForeignKey
{
return $this->foreignKey;
}
}