-
-
Notifications
You must be signed in to change notification settings - Fork 505
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
Deprecate legacy commit options #2578
Deprecate legacy commit options #2578
Conversation
Note: static analysis errors are handled in #2554 |
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.
Optional suggestion to replace continue
with the trigger_deprecation
call but I defer to you. LGTM.
@@ -449,6 +450,19 @@ public function getDefaultCommitOptions(): array | |||
/** @psalm-param CommitOptions $defaultCommitOptions */ | |||
public function setDefaultCommitOptions(array $defaultCommitOptions): void | |||
{ | |||
foreach (UnitOfWork::DEPRECATED_WRITE_OPTIONS as $deprecatedOption) { | |||
if (! array_key_exists($deprecatedOption, $defaultCommitOptions)) { |
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.
Would it make sense to flip this logic and avoid the continue
? This isn't a matter of nesting conditionals, so I think we could go either way here.
Up to you.
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 is possible with a small change to the phpcs configuration. The early exit is now no longer required if there's only a single if in the scope. Good judgment should still be applied :)
continue; | ||
} | ||
|
||
trigger_deprecation( |
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.
TIL symfony/deprecation-contracts exists. Is this something we might want to use in PHPLIB down the line? Or do you think we should stick with the forthcoming logging API?
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.
FWIW there's also https://github.com/doctrine/deprecations but we never changed ODM (we were using Symfony's stuff before Doctrine's was introduced)
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.
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 see no benefits either so no worries ;)
@@ -88,6 +90,9 @@ final class UnitOfWork implements PropertyChangedListener | |||
*/ | |||
public const STATE_REMOVED = 4; | |||
|
|||
/** @internal */ | |||
public const DEPRECATED_WRITE_OPTIONS = ['fsync', 'safe', 'w']; |
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.
This makes me wonder how w
interacts with an explicit writeConcern
option, but that's beyond the scope of this deprecation PR.
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'll take care of the bundle separately - I need to think about how I can allow users to configure a WriteConcern object without having to create a service for it. |
I think you could try having something along:
and then in Configuration class remap |
* 2.6.x: (30 commits) Remove API link from README Aggregation uses CursorInterface instead of Cursor Deprecate legacy commit options (#2578) Improve handling of circular type reference errors in Phpstan Add missing phpdoc Fix return type for overridden methods Fix phpstan errors Add sort operator to $search stage Bump actions/upload-artifact from 2 to 3 (#2572) Implement ObjectManager::isUninitializedObject (#2569) Use PHPUnit 10 (#2564) Test Symfony 7 Support Symfony 7 by adding return types conditionally PHPCS is now happy with new syntax Stop suppressing UndefinedAttributeClass Drop support for old symfony components ReferenceMany: insert an empty array feat: Symfony 7 support Remove unusable Match classes Require PHP 8.1 ...
* 2.6.x: (32 commits) Deprecate DocumentRepository::clear (#2584) Support minDistance and maxDistance options for $near and $nearSphere operators (#2583) Remove API link from README Aggregation uses CursorInterface instead of Cursor Deprecate legacy commit options (#2578) Improve handling of circular type reference errors in Phpstan Add missing phpdoc Fix return type for overridden methods Fix phpstan errors Add sort operator to $search stage Bump actions/upload-artifact from 2 to 3 (#2572) Implement ObjectManager::isUninitializedObject (#2569) Use PHPUnit 10 (#2564) Test Symfony 7 Support Symfony 7 by adding return types conditionally PHPCS is now happy with new syntax Stop suppressing UndefinedAttributeClass Drop support for old symfony components ReferenceMany: insert an empty array feat: Symfony 7 support ...
Summary
The
fsync
,safe
, andw
options can be deprecated, as they are all handled by thewriteConcern
commit option.