1 | <?php |
||
18 | abstract class AbstractCommander |
||
19 | { |
||
20 | /** |
||
21 | * @var Driver |
||
22 | */ |
||
23 | private $driver = null; |
||
24 | |||
25 | /** |
||
26 | * @param Driver $driver |
||
27 | */ |
||
28 | public function __construct(Driver $driver) |
||
32 | |||
33 | /** |
||
34 | * Associated driver. |
||
35 | * |
||
36 | * @return Driver |
||
37 | */ |
||
38 | public function driver() |
||
42 | |||
43 | /** |
||
44 | * Create table! |
||
45 | * |
||
46 | * @param AbstractTable $table |
||
47 | * |
||
48 | * @return self |
||
49 | */ |
||
50 | public function createTable(AbstractTable $table) |
||
62 | |||
63 | /** |
||
64 | * Drop table from database. |
||
65 | * |
||
66 | * @param string $table |
||
67 | */ |
||
68 | public function dropTable($table) |
||
72 | |||
73 | /** |
||
74 | * Rename table from one name to another. |
||
75 | * |
||
76 | * @param string $table |
||
77 | * @param string $name |
||
78 | * |
||
79 | * @return self |
||
80 | */ |
||
81 | public function renameTable($table, $name) |
||
87 | |||
88 | /** |
||
89 | * Driver specific column add command. |
||
90 | * |
||
91 | * @param AbstractTable $table |
||
92 | * @param AbstractColumn $column |
||
93 | * |
||
94 | * @return self |
||
95 | */ |
||
96 | public function addColumn(AbstractTable $table, AbstractColumn $column) |
||
102 | |||
103 | /** |
||
104 | * Driver specific column remove (drop) command. |
||
105 | * |
||
106 | * @param AbstractTable $table |
||
107 | * @param AbstractColumn $column |
||
108 | * |
||
109 | * @return self |
||
110 | */ |
||
111 | public function dropColumn(AbstractTable $table, AbstractColumn $column) |
||
122 | |||
123 | /** |
||
124 | * Driver specific column alter command. |
||
125 | * |
||
126 | * @param AbstractTable $table |
||
127 | * @param AbstractColumn $initial |
||
128 | * @param AbstractColumn $column |
||
129 | * |
||
130 | * @return self |
||
131 | */ |
||
132 | abstract public function alterColumn( |
||
137 | |||
138 | /** |
||
139 | * Driver specific index adding command. |
||
140 | * |
||
141 | * @param AbstractTable $table |
||
142 | * @param AbstractIndex $index |
||
143 | * |
||
144 | * @return self |
||
145 | */ |
||
146 | public function addIndex(AbstractTable $table, AbstractIndex $index) |
||
152 | |||
153 | /** |
||
154 | * Driver specific index remove (drop) command. |
||
155 | * |
||
156 | * @param AbstractTable $table |
||
157 | * @param AbstractIndex $index |
||
158 | * |
||
159 | * @return self |
||
160 | */ |
||
161 | public function dropIndex(AbstractTable $table, AbstractIndex $index) |
||
167 | |||
168 | /** |
||
169 | * Driver specific index alter command, by default it will remove and add index. |
||
170 | * |
||
171 | * @param AbstractTable $table |
||
172 | * @param AbstractIndex $initial |
||
173 | * @param AbstractIndex $index |
||
174 | * |
||
175 | * @return self |
||
176 | */ |
||
177 | public function alterIndex(AbstractTable $table, AbstractIndex $initial, AbstractIndex $index) |
||
181 | |||
182 | /** |
||
183 | * Driver specific foreign key adding command. |
||
184 | * |
||
185 | * @param AbstractTable $table |
||
186 | * @param AbstractReference $foreign |
||
187 | * |
||
188 | * @return self |
||
189 | */ |
||
190 | public function addForeign(AbstractTable $table, AbstractReference $foreign) |
||
196 | |||
197 | /** |
||
198 | * Driver specific foreign key remove (drop) command. |
||
199 | * |
||
200 | * @param AbstractTable $table |
||
201 | * @param AbstractReference $foreign |
||
202 | * |
||
203 | * @return self |
||
204 | */ |
||
205 | public function dropForeign(AbstractTable $table, AbstractReference $foreign) |
||
209 | |||
210 | /** |
||
211 | * Driver specific foreign key alter command, by default it will remove and add foreign key. |
||
212 | * |
||
213 | * @param AbstractTable $table |
||
214 | * @param AbstractReference $initial |
||
215 | * @param AbstractReference $foreign |
||
216 | * |
||
217 | * @return self |
||
218 | */ |
||
219 | public function alterForeign( |
||
226 | |||
227 | /** |
||
228 | * Drop column constraint using it's name. |
||
229 | * |
||
230 | * @param AbstractTable $table |
||
231 | * @param string $constraint |
||
232 | * |
||
233 | * @return self |
||
234 | */ |
||
235 | public function dropConstrain(AbstractTable $table, $constraint) |
||
241 | |||
242 | /** |
||
243 | * Execute statement. |
||
244 | * |
||
245 | * @param string $statement |
||
246 | * @param array $parameters |
||
247 | * |
||
248 | * @return \PDOStatement |
||
249 | */ |
||
250 | protected function run($statement, array $parameters = []) |
||
254 | |||
255 | /** |
||
256 | * Quote identifier. |
||
257 | * |
||
258 | * @param string $identifier |
||
259 | * |
||
260 | * @return string |
||
261 | */ |
||
262 | protected function quote($identifier) |
||
266 | |||
267 | /** |
||
268 | * Get statement needed to create table. |
||
269 | * |
||
270 | * @param AbstractTable $table |
||
271 | * |
||
272 | * @return string |
||
273 | */ |
||
274 | protected function createStatement(AbstractTable $table) |
||
301 | } |
||
302 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.