src/Database/QueryBuilder/Commands/Create.php
/**
	 * Adds a FOREIGN KEY INDEX to one or more columns.
	 *
	 * @param string|string[] $column
	 * @param string $foreignTable
	 * @param string|string[] $foreignColumn
	 * @param string|null $onDelete
	 * @param string|null $onUpdate
	 * @return $this
	 */
Adds a FOREIGN KEY INDEX to one or more columns.
Adds a FOREIGN KEY INDEX to one or more columns .
public function foreign($column, $foreignTable, $foreignColumn, $onDelete = null, $onUpdate = null) {
		if (!is_array($foreignColumn)) $foreignColumn = array($foreignColumn);
		if (!is_array($column)) $column = array($column);
		$this->keys[] = array(
			'type' => 'FOREIGN KEY',
			'columns' => $column,
			'references' => array(
				'table' => $foreignTable,
				'columns' => $foreignColumn,
			),
			'onDelete' => $onDelete,
			'onUpdate' => $onUpdate
		);
		return $this;
	}
public function foreign ( $ column , $ foreignTable , $ foreignColumn , $ onDelete = null , $ onUpdate = null ) { if ( ! is_array ( $ foreignColumn ) ) $ foreignColumn = array ( $ foreignColumn ) ; if ( ! is_array ( $ column ) ) $ column = array ( $ column ) ; $ this -> keys [ ] = array ( 'type' => 'FOREIGN KEY' , 'columns' => $ column , 'references' => array ( 'table' => $ foreignTable , 'columns' => $ foreignColumn , ) , 'onDelete' => $ onDelete , 'onUpdate' => $ onUpdate ) ; return $ this ; }
Adds a FOREIGN KEY INDEX to one or more columns.
Adds a FOREIGN KEY INDEX to one or more columns .
// Ensure the columns are arrays