1 | <?php |
||
54 | trait AbstractDirectActionTrait |
||
55 | { |
||
56 | /** |
||
57 | * Executes all the ALTER TABLE instructions passed for the given table |
||
58 | * |
||
59 | * @param string $tableName The table name to use in the ALTER statement |
||
60 | * @param AlterInstructions $instructions The object containing the alter sequence |
||
61 | * @return void |
||
62 | */ |
||
63 | abstract protected function executeAlterSteps($tableName, AlterInstructions $instructions); |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function addColumn(Table $table, Column $column) |
||
73 | |||
74 | /** |
||
75 | * Returns the instructions to add the specified column to a database table. |
||
76 | * |
||
77 | * @param \Phinx\Db\Table\Table $table Table |
||
78 | * @param \Phinx\Db\Table\Column $column Column |
||
79 | * @return AlterInstructions |
||
80 | */ |
||
81 | abstract protected function getAddColumnInstructions(Table $table, Column $column); |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | public function renameColumn($tableName, $columnName, $newColumnName) |
||
91 | |||
92 | /** |
||
93 | * Returns the instructions to rename the specified column. |
||
94 | * |
||
95 | * @param string $tableName Table Name |
||
96 | * @param string $columnName Column Name |
||
97 | * @param string $newColumnName New Column Name |
||
98 | * @return AlterInstructions |
||
99 | * |
||
100 | */ |
||
101 | abstract protected function getRenameColumnInstructions($tableName, $columnName, $newColumnName); |
||
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | public function changeColumn($tableName, $columnName, Column $newColumn) |
||
111 | |||
112 | /** |
||
113 | * Returns the instructions to change a table column type. |
||
114 | * |
||
115 | * @param string $tableName Table Name |
||
116 | * @param string $columnName Column Name |
||
117 | * @param \Phinx\Db\Table\Column $newColumn New Column |
||
118 | * @return AlterInstructions |
||
119 | */ |
||
120 | abstract protected function getChangeColumnInstructions($tableName, $columnName, Column $newColumn); |
||
121 | |||
122 | /** |
||
123 | * {@inheritdoc} |
||
124 | */ |
||
125 | public function dropColumn($tableName, $columnName) |
||
130 | |||
131 | /** |
||
132 | * Returns the instructions to drop the specified column. |
||
133 | * |
||
134 | * @param string $tableName Table Name |
||
135 | * @param string $columnName Column Name |
||
136 | * @return AlterInstructions |
||
137 | */ |
||
138 | abstract protected function getDropColumnInstructions($tableName, $columnName); |
||
139 | |||
140 | /** |
||
141 | * {@inheritdoc} |
||
142 | */ |
||
143 | public function addIndex(Table $table, Index $index) |
||
148 | |||
149 | /** |
||
150 | * Returns the instructions to add the specified index to a database table. |
||
151 | * |
||
152 | * @param \Phinx\Db\Table\Table $table Table |
||
153 | * @param \Phinx\Db\Table\Index $index Index |
||
154 | * @return AlterInstructions |
||
155 | */ |
||
156 | abstract protected function getAddIndexInstructions(Table $table, Index $index); |
||
157 | |||
158 | /** |
||
159 | * {@inheritdoc} |
||
160 | */ |
||
161 | public function dropIndex($tableName, $columns) |
||
166 | |||
167 | /** |
||
168 | * Returns the instructions to drop the specified index from a database table. |
||
169 | * |
||
170 | * @param string $tableName The name of of the table where the index is |
||
171 | * @param mixed $columns Column(s) |
||
172 | * @return AlterInstructions |
||
173 | */ |
||
174 | abstract protected function getDropIndexByColumnsInstructions($tableName, $columns); |
||
175 | |||
176 | /** |
||
177 | * {@inheritdoc} |
||
178 | */ |
||
179 | public function dropIndexByName($tableName, $indexName) |
||
184 | |||
185 | /** |
||
186 | * Returns the instructions to drop the index specified by name from a database table. |
||
187 | * |
||
188 | * @param string $tableName The table name whe the index is |
||
189 | * @param string $indexName The name of the index |
||
190 | * @return AlterInstructions |
||
191 | */ |
||
192 | abstract protected function getDropIndexByNameInstructions($tableName, $indexName); |
||
193 | |||
194 | /** |
||
195 | * {@inheritdoc} |
||
196 | */ |
||
197 | public function addForeignKey(Table $table, ForeignKey $foreignKey) |
||
202 | |||
203 | /** |
||
204 | * Returns the instructions to adds the specified foreign key to a database table. |
||
205 | * |
||
206 | * @param \Phinx\Db\Table\Table $table The table to add the constraint to |
||
207 | * @param \Phinx\Db\Table\ForeignKey $foreignKey The foreign key to add |
||
208 | * @return AlterInstructions |
||
209 | */ |
||
210 | abstract protected function getAddForeignKeyInstructions(Table $table, ForeignKey $foreignKey); |
||
211 | |||
212 | /** |
||
213 | * {@inheritdoc} |
||
214 | */ |
||
215 | public function dropForeignKey($tableName, $columns, $constraint = null) |
||
225 | |||
226 | /** |
||
227 | * Returns the instructions to drop the specified foreign key from a database table. |
||
228 | * |
||
229 | * @param string $tableName The table where the foreign key constraint is |
||
230 | * @param string $constraint Constraint name |
||
231 | * @return AlterInstructions |
||
232 | */ |
||
233 | abstract protected function getDropForeignKeyInstructions($tableName, $constraint); |
||
234 | |||
235 | /** |
||
236 | * Returns the instructions to drop the specified foreign key from a database table. |
||
237 | * |
||
238 | * @param string $tableName The table where the foreign key constraint is |
||
239 | * @param array $columns The list of column names |
||
240 | * @return AlterInstructions |
||
241 | */ |
||
242 | abstract protected function getDropForeignKeyByColumnsInstructions($tableName, $columns); |
||
243 | |||
244 | /** |
||
245 | * {@inheritdoc} |
||
246 | */ |
||
247 | public function dropTable($tableName) |
||
252 | |||
253 | /** |
||
254 | * Returns the instructions to drop the specified database table. |
||
255 | * |
||
256 | * @param string $tableName Table Name |
||
257 | * @return AlterInstructions |
||
258 | */ |
||
259 | abstract protected function getDropTableInstructions($tableName); |
||
260 | |||
261 | /** |
||
262 | * {@inheritdoc} |
||
263 | */ |
||
264 | public function renameTable($tableName, $newTableName) |
||
269 | |||
270 | /** |
||
271 | * Returns the instructions to rename the specified database table. |
||
272 | * |
||
273 | * @param string $tableName Table Name |
||
274 | * @param string $newTableName New Name |
||
275 | * @return AlterInstructions |
||
276 | */ |
||
277 | abstract protected function getRenameTableInstructions($tableName, $newTableName); |
||
278 | |||
279 | /** |
||
280 | * {@inheritdoc} |
||
281 | */ |
||
282 | public function changePrimaryKey(Table $table, $newColumns) |
||
287 | |||
288 | /** |
||
289 | * Returns the instructions to change the primary key for the specified database table. |
||
290 | * |
||
291 | * @param Table $table Table |
||
292 | * @param string|array|null $newColumns Column name(s) to belong to the primary key, or null to drop the key |
||
293 | * @return AlterInstructions |
||
294 | */ |
||
295 | abstract protected function getChangePrimaryKeyInstructions(Table $table, $newColumns); |
||
296 | |||
297 | /** |
||
298 | * {@inheritdoc} |
||
299 | */ |
||
300 | public function changeComment(Table $table, $newComment) |
||
305 | |||
306 | /** |
||
307 | * Returns the instruction to change the comment for the specified database table. |
||
308 | * |
||
309 | * @param Table $table Table |
||
310 | * @param string|null $newComment New comment string, or null to drop the comment |
||
311 | * @return AlterInstructions |
||
312 | */ |
||
313 | abstract protected function getChangeCommentInstructions(Table $table, $newComment); |
||
314 | |||
315 | /** |
||
316 | * {@inheritdoc} |
||
317 | */ |
||
318 | public function executeActions(Table $table, array $actions) |
||
423 | } |
||
424 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.