-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Address API removals from upstream #9885
Conversation
When I introduced OrmFunctionalTestCase::createSchemaForModels(), I made several wrong assumptions: - the call is always wrapped in a try / catch; - that try / catch is always typed with "Exception". Because of that, I missed, many, many occurrences of SchemaTool::createSchema(). I recently noticed that contributors kept using the SchemaTool::createSchema() and figured not everything had been migrated. Migrating some of them did not result in something far better until I also introduced similar methods for SchemaTool::getUpdateSchemaSql() and SchemaTool::getSchemaFromMetadata().
Migrate more usages of SchemaTool::createSchema()
*FlushEventArgs classes should extend ManagerEventArgs from doctrine/persistence to be able to use ManagerEventArgs for any persistance implementation. OnClearEventArgs should extend from OnClearEventArgs from doctrine/persistence.
If ObjectHydrator faces an empty row to an uninitialized collection, it initializes it, to prevent it from querying again (DDC-1526). However, if that row is the first but not the only in the collection, the next rows will be ignored, as the collection will be considered "existing", and "existing" collections are only replaced if REFRESH hint is present. To prevent it, we defer initialization to the end of the hydration. Fixes doctrineGH-9807
[doctrineGH-9807] Fix: initialize potentially empty collections at the hydration complete
Change parent classes in some events
Fix typo in AbstractQuery
9495bb8
to
8c43b3d
Compare
The removal of custom schema options seems to break the code introduced in #9655 for some reason… |
* 2.12.x: PHPStan 1.8.0 (doctrine#9887) Fix typo in AbstractQuery ObjectHydrator: defer initialization of potentially empty collections Migrate more usages of SchemaTool::createSchema() preUpdate: Add restriction that changed field needs to be in computed changeset (doctrine#9871)
@ruudk @morozov maybe you can help with this failure: https://github.com/doctrine/orm/runs/7242015946?check_suite_focus=true#step:7:79 I don't understand what's happening, but I think it must be somehow related to custom schema options. The original PR of @ruudk relied on them: #9636 , but not the second one: #9655 |
final protected function assertQueryLog(string ...$expectedQueries): void | ||
{ | ||
self::assertSame($expectedQueries, array_column($this->getQueryLog()->queries, 'sql')); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introducing that method allows to compare the 2 query logs rather than getting an exception because there is no seventh query.
Custom options are not mentioned in the code, but they are mentioned in the summary of that PR though 🤔 UPD: I think this line is throwing away the extra options: orm/lib/Doctrine/ORM/Tools/SchemaTool.php Line 799 in 291765e
Before my changes, there was a separation into known options and custom ones: https://github.com/doctrine/orm/blob/2.12.x/lib/Doctrine/ORM/Tools/SchemaTool.php#L799-L800 Removing that breaks the test suite because of how enum types are implemented, but that might be the way to go, I'll have to investigate why that separation was needed in the first place. The issue with the test suite is related to #9382 Now it blows up with @morozov , what's the upgrade path for this? UPD: nevermind, I think I've found what needed to be done. |
The build is green, but I'm not setting this as ready for review yet: there are things I can backport, and other things that might be incorrect. |
c2caf0a
to
725ecc2
Compare
SerializationModel has a field with type array, and another with type object. Both types are deprecated.
It contains fields with deprecated types.
…ype-deprecation Address array object type deprecation
Merge 2.12.x up into 2.13.x
$options = array_intersect_key($mappingOptions, array_flip(self::KNOWN_COLUMN_OPTIONS)); | ||
$options['customSchemaOptions'] = array_diff_key($mappingOptions, $options); | ||
$options = array_intersect_key($mappingOptions, array_flip(self::KNOWN_COLUMN_OPTIONS)); | ||
$options['platformOptions'] = array_diff_key($mappingOptions, $options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if I should backport this as well… Column::getCustomSchemaOptions()
will not return the same thing as previously, not sure how acceptable that is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave it as is in older branches. This API is supported up until DBAL 4.0, so there's no reason to break anything prior to supporting it.
27fa390
to
3bd0427
Compare
Custom schema options have been removed in doctrine/dbal 4
I've backported what was reasonable to backport; this is now the combination of a merge-up and fixes for the build (which are in separate commits) |
doctrine/dbal#5477 has removed 2 things: