1: <?php
2:
3: namespace Alchemy\core\schema;
4:
5:
6: /**
7: * Represent a column in SQL with a foreign key constraint to another column
8: */
9: class Foreign extends Column {
10: public function copy(array $args = array(), $table = null, $name = '?') {
11: $source = is_string($this->args[0])
12: ? Column::find($this->args[0], $table)
13: : $this->args[0];
14:
15: // only override keyword args
16: $args['foreign_key'] = $source;
17: $args['auto_increment'] = false;
18: $args += array_slice($this->args, 1, NULL);
19:
20: return $source->copy($args, $table, $name);
21: }
22: }