-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHPLIB-1182: Support codec option in operation classes (#1140)
* Add Codec support to find operations * Add codec support to insert operations * Add codec support to replace operation * Add codec support to aggregate operation * Add codec support to BulkWrite operation * Add codec support to findAndModify operations * Add codec support to Watch operation * Support passing default codec to collection class * Remove temporary variable usage in operations * Enforce iterator type when creating ChangeStreamIterator * Remove unnecessary null-coalesce * Ensure operation-level type map gets precedence over collection-level codec * Reference psalm issue regarding unions and assert-if type annotations * Add iterator type in ReadableStream * Assume _id property will be present in change stream result document. * Prohibit specifying typeMap and codec options for operations This commit also refactors the logic of inheriting collection-level options to operations to reduce code duplication. * Defer server selection until executing operation * Remove useless assertion * Assert iterator type in ChangeStreamIterator::getInnerIterator * Make assertions on encoded result conditional * Extract factory to created decoded fixtures * Split document creation for legibility * Insert fixture through factory in test object * Trigger warning when calling CodecCursor::setTypeMap * Encode documents before type checks This commit also changes the behaviour to use encode() instead of encodeIfSupported(), requiring documents to be encodable by the given codec in order to be inserted/updated. * Use more descriptive value in failing tests * Add clarifying comment on skipping validation * Simplify double isset check * Split chained calls when inheriting options * Defer server selection in Collection::drop() * Split inheritReadOptions method * Use decode() instead of decodeIfSupported() * Add explanatory comment for ID filling behaviour * Handle null values in findAndModify responses * Update comment regarding missing identifiers in tests * Use intersection type for change streams * Prohibit specifying codec and typeMap options to Watch
- Loading branch information
Showing
47 changed files
with
2,161 additions
and
554 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.