Fix Migrator with joined/imported fields#1227
Merged
mvorisek merged 8 commits intoatk4:developfrom Aug 5, 2024
Merged
Conversation
Contributor
Author
|
PR ready to merge |
mvorisek
reviewed
Aug 5, 2024
|
|
||
| if ($field->shortName === $model->idField) { | ||
| $refype = self::REF_TYPE_PRIMARY; | ||
| $refType = self::REF_TYPE_PRIMARY; |
mvorisek
reviewed
Aug 5, 2024
mvorisek
reviewed
Aug 5, 2024
tests/Schema/MigratorTest.php
Outdated
| // functional test for Expression::escapeStringLiteral() method | ||
| $strRaw = $model->getPersistence()->typecastSaveField($model->getField('v'), $str); | ||
| $strRawSql = \Closure::bind(static fn () => $model->expr('')->escapeStringLiteral($strRaw), null, Expression::class)(); | ||
| $strRawSql = \Closure::bind( |
Member
There was a problem hiding this comment.
We would have to do this CS change consistently across all repos which is not easily possible, as \Closure::bind is very often used inside some expr. (like if)
please revert these CS changes - if they were done by your IDE, I advise you to disable them for atk4/* repos at least
mvorisek
reviewed
Aug 5, 2024
tests/Schema/MigratorTest.php
Outdated
| foreach ($creatingMigrator->table->getColumns() as $column) { | ||
| $expectedFields[$column->getName()] = [ | ||
| 'type' => Type::getTypeRegistry()->lookupName($column->getType()), // TODO simplify once https://github.com/doctrine/dbal/pull/6130 is merged | ||
| 'type' => Type::getTypeRegistry()->lookupName($column->getType()), |
Member
There was a problem hiding this comment.
this CS change is to be reverted as well - and never place comment below
mvorisek
reviewed
Aug 5, 2024
mvorisek
reviewed
Aug 5, 2024
1dff9db to
ee10160
Compare
Member
|
Thank you, makes sense! |
Contributor
Author
|
Thanks for improving the PR. I only made the CS because the github workflow complained about it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #1226
Currently, migrator does create Model fields that are defined by
Model::leftJoin()within the model table when exexutingMigrator::create().As these fields are defined by a weak join, they should not be created within the model table but their values should be loaded from the joined table on load.