1 | <?php |
||
23 | class Index implements IndexInterface |
||
24 | { |
||
25 | protected $table; |
||
26 | protected $name; |
||
27 | protected $type; |
||
28 | protected $fields = []; |
||
29 | |||
30 | /** |
||
31 | * Constructor |
||
32 | * |
||
33 | * @param string $name |
||
34 | * @param array $fields |
||
35 | */ |
||
36 | public function __construct($name, array $fields) |
||
45 | |||
46 | /** |
||
47 | * Asserts index fields |
||
48 | * |
||
49 | * @param array $fields |
||
50 | * |
||
51 | * @throws DefinitionException |
||
52 | */ |
||
53 | protected function assertFields($fields) |
||
59 | |||
60 | /** |
||
61 | * Returns name of table |
||
62 | * |
||
63 | * @param string $table |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | public function table($table = null) |
||
75 | |||
76 | /** |
||
77 | * Returns relation name in entity |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | public function name() |
||
85 | |||
86 | /** |
||
87 | * Returns relation type |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | public function type() |
||
95 | |||
96 | /** |
||
97 | * Returns array containing field names (unmapped) that are included in index |
||
98 | * |
||
99 | * @return array |
||
100 | */ |
||
101 | public function fields() |
||
105 | |||
106 | /** |
||
107 | * Checks if index uses field (unmapped) |
||
108 | * Returns true if it does |
||
109 | * |
||
110 | * @param string $field |
||
111 | * |
||
112 | * @return bool |
||
113 | */ |
||
114 | public function hasField($field) |
||
118 | |||
119 | /** |
||
120 | * Returns true if index is primary index |
||
121 | * |
||
122 | * @return bool |
||
123 | */ |
||
124 | public function isPrimary() |
||
128 | |||
129 | /** |
||
130 | * Returns true if index is unique |
||
131 | * |
||
132 | * @return bool |
||
133 | */ |
||
134 | public function isUnique() |
||
138 | } |
||
139 |