Start migration to TableEditor API - #12523
Conversation
89e0f44 to
9dfbf97
Compare
| self::addPrimaryKeyConstraint($table, $pkColumns); | ||
| if ($tableOrEditor instanceof TableEditor) { | ||
| $tableOrEditor = $tableOrEditor->create(); | ||
| } |
There was a problem hiding this comment.
This is why this PR is called "start migration to TableEditor API"
By making sure I end up with a table beyond this point, I make this big PR hopefully not too big.
There was a problem hiding this comment.
I just came here to comment on this block: after it, $tableOrEditor is guaranteed to be a table, so it may be worth assigning the result to Table $table and revert the following changes that replace $table with $tableOrEditor.
There was a problem hiding this comment.
Will do, it will be less confusing.
|
|
||
| foreach ($platformOptions as $key => $value) { | ||
| if (! in_array($key, $knownPlatformOptions, true)) { | ||
| $column->setPlatformOption($key, $value); |
There was a problem hiding this comment.
@morozov do you think this is useful? If not, should the deprecation message be improved to indicate that calling that method with e.g. foo achieves nothing and will cause an error in 5.0.x? I'm asking because ORM has a test ensuring foo is preserved:
orm/tests/Tests/ORM/Tools/SchemaToolTest.php
Lines 88 to 104 in 883c76a
I'm wondering if I should remove this piece of code entirely, or trigger a deprecation if we enter it.
There was a problem hiding this comment.
@morozov do you think this is useful?
In theory it may be useful: someone may have a custom platform with an option not known to the ORM. In practice, I don't think so.
If not, should the deprecation message be improved to indicate that calling that method with e.g. foo achieves nothing and will cause an error in 5.0.x?
I'm not following. The entire Column::setPlatformOption() is deprecated and will be removed in 5.0.x for exactly that reason: ColumnEditor provides a well-typed API for supported parameters.
There was a problem hiding this comment.
Oh so right now, it might achieve something, but in the future, you won't even be able to call it with foo.
|
The change looks directionally right (I've only reviewed half the PR, and mostly found just nits). For the issues raised in the comments above, I'd step back and look at the code in question in isolation from the migration to editors, to see if the code itself looks sane (in the two cases above, it doesn't). Then I'd address those issues separately and get back to the migration — this is the process I've been following during the API rework in DBAL itself. |
The TableEditor API has no equivalent for this. Avoiding that call should allow migrating to that API.
01cc480 to
42c9d12
Compare
The
TableEditorAPI has no equivalent for this. Avoiding that call should allow migrating to that API.