1 | <?php |
||
21 | class ConstraintExpression implements ExpressionInterface |
||
22 | { |
||
23 | use Attributes; |
||
24 | |||
25 | const KEY_TYPE_NONE = 0; |
||
26 | const KEY_TYPE_PRIMARY = 1; |
||
27 | const KEY_TYPE_UNIQUE = 2; |
||
28 | const KEY_TYPE_FOREIGN = 3; |
||
29 | |||
30 | const INDEX_TYPE_NONE = 0; // but maybe use B-Tree |
||
31 | const INDEX_TYPE_BTREE = 1; |
||
32 | const INDEX_TYPE_HASH = 2; |
||
33 | |||
34 | /** @var array */ |
||
35 | protected $columns; |
||
36 | |||
37 | /** @var string */ |
||
38 | protected $name; |
||
39 | |||
40 | /** @var \Wandu\Database\Query\Expression\ReferenceExpression */ |
||
41 | protected $reference; |
||
42 | |||
43 | /** |
||
44 | * @param array $columns |
||
45 | * @param string $name |
||
46 | * @param array $attributes |
||
47 | */ |
||
48 | 1 | public function __construct(array $columns, $name = null, array $attributes = []) |
|
54 | |||
55 | /** |
||
56 | * @param string $table |
||
57 | * @param string|array $column |
||
58 | * @return \Wandu\Database\Query\Expression\ReferenceExpression |
||
59 | */ |
||
60 | 1 | public function reference($table, $column) |
|
64 | |||
65 | /** |
||
66 | * @example |
||
67 | * KEY [index_name] [index_type] (index_col_name,...) |
||
68 | * PRIMARY KEY [index_type] (index_col_name,...) |
||
69 | * UNIQUE KEY [index_name] [index_type] (index_col_name,...) |
||
70 | * FOREIGN KEY [index_name] (index_col_name,...) ReferenceExpression |
||
71 | * |
||
72 | * {@inheritdoc} |
||
73 | */ |
||
74 | 1 | public function toSql() |
|
109 | |||
110 | /** |
||
111 | * {@inheritdoc} |
||
112 | */ |
||
113 | public function getBindings() |
||
117 | } |
||
118 |
As per the PSR-2 coding standard, the
break
(or other terminating) statement must be on a line of its own.To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.