-
-
Notifications
You must be signed in to change notification settings - Fork 515
[3.x] Drop deprecated features #2956
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
base: 3.0.x
Are you sure you want to change the base?
Conversation
96223a6 to
0ba3c99
Compare
0ba3c99 to
c6ed532
Compare
da7be12 to
eb94490
Compare
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.
Pull request overview
This PR removes several deprecated features from the MongoDB ODM 3.x branch as part of a breaking change cleanup:
- Deprecated write concern options (
fsync,safe,w) LegacyReflectionFieldssupport in favor ofPropertyAccessors- NOTIFY change tracking policy support
indexesattribute property in document annotations- Combination of
targetDocumentwithdiscriminatorMap(now throws exception)
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/UnitOfWork.php |
Removed deprecated write concern options handling and NOTIFY change tracking logic |
src/Persisters/DocumentPersister.php |
Removed deprecated write concern option handling from write options |
src/PersistentCollection/PersistentCollectionTrait.php |
Removed NOTIFY change tracking support and needsSchedulingForSynchronization() method |
src/Mapping/LegacyReflectionFields.php |
Deleted entire legacy reflection fields implementation |
src/Mapping/Driver/AttributeDriver.php |
Removed handling of deprecated indexes attribute property |
src/Mapping/ClassMetadataFactory.php |
Removed deprecation warning for NOTIFY change tracking policy |
src/Mapping/ClassMetadata.php |
Removed LegacyReflectionFields properties and methods; changed targetDocument + discriminatorMap from deprecation to exception |
src/Mapping/MappingException.php |
Added new exception method for targetDocument + discriminatorMap combination |
src/Mapping/Annotations/File.php |
Removed deprecated indexes parameter from File annotation |
src/Mapping/Annotations/EmbeddedDocument.php |
Removed deprecated indexes parameter and constructor from EmbeddedDocument annotation |
src/Configuration.php |
Removed deprecated write concern options validation from configuration |
tests/Tests/Mapping/LegacyReflectionFieldsTest.php |
Deleted test file for removed LegacyReflectionFields feature |
tests/Tests/Mapping/ClassMetadataTest.php |
Removed assertion checking for LegacyReflectionFields instance |
Comments suppressed due to low confidence (1)
src/PersistentCollection/PersistentCollectionTrait.php:741
- The
needsSchedulingForSynchronization()method is being removed, but it's still referenced inDefaultPersistentCollectionGenerator::generateMethod()at line 199. This will cause a fatal error when generated persistent collection classes try to call this non-existent method. The generator code should also be updated to remove the call to this method.
/**
* @phpstan-param Closure(TKey, T):bool $p
*
* @phpstan-return T|null
*/
public function findFirst(Closure $p): ?object
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
eb94490 to
9ae4c98
Compare
9ae4c98 to
7288293
Compare
7288293 to
cb78c45
Compare
| $metadata->addLifecycleCallback('doStuffOnPrePersist', 'prePersist'); | ||
| $metadata->addLifecycleCallback('doOtherStuffOnPrePersistToo', 'prePersist'); | ||
| $metadata->addLifecycleCallback('doStuffOnPostPersist', 'postPersist'); | ||
| $metadata->setDiscriminatorField(['fieldName' => 'discr']); |
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 found that this loadMetadata() method is not even called - all tests were passing without TypeError thrown, when I left it like that.
Perhaps we can remove this method completely.
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.
Yes, it can be removed here and from the 2.x branch.
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.
It looks like a aborted attempt to use StaticPHPDriver https://github.com/doctrine/persistence/blob/f7deb2207f44cd2cd30a59bec3d2451738848af6/docs/en/reference/index.rst#staticphpdriver
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 think we can leave it for now and try to cover it with a different test.
Summary
Removes some features marked as deprecated:
fsync,safeandwwrite concernsindexesattribute propertyLegacyReflectionFieldssupportNOTIFYchange tracking policy supporttargetDocumentwithdiscriminatorMapwill now trigger exception.setDiscriminatorField