1 | <?php |
||
31 | class AddForeignKey extends Action |
||
32 | { |
||
33 | |||
34 | /** |
||
35 | * The foreign key to add |
||
36 | * |
||
37 | * @var ForeignKey |
||
38 | */ |
||
39 | protected $foreignKey; |
||
40 | |||
41 | /** |
||
42 | * Constructor |
||
43 | * |
||
44 | * @param Table $table The table to add the foreign key to |
||
45 | * @param ForeignKey $fk The foreign key to add |
||
46 | */ |
||
47 | public function __construct(Table $table, ForeignKey $fk) |
||
52 | |||
53 | /** |
||
54 | * Creats a new AddForeignKey object after building the foreign key with |
||
55 | * the passed attibutes |
||
56 | * |
||
57 | * @param Table $table The table object to add the foreign key to |
||
58 | * @param string|string[] $columns The columns for the foreign key |
||
59 | * @param Table|string $referencedTable The table the foreign key references |
||
60 | * @param string $referencedColumns The columns in the referenced table |
||
61 | * @param array $options Extra options for the foreign key |
||
62 | * @param string|null $name The name of the foreing key |
||
63 | * @return AddForeignKey |
||
64 | */ |
||
65 | public static function build(Table $table, $columns, $referencedTable, $referencedColumns = ['id'], array $options = [], $name = null) |
||
87 | |||
88 | /** |
||
89 | * Returns the foreign key to be added |
||
90 | * |
||
91 | * @return ForeignKey |
||
92 | */ |
||
93 | public function getForeignKey() |
||
97 | } |
||
98 |