Skip to content

Commit

Permalink
PHPLIB-1517: Remove Executable interface
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Sep 26, 2024
1 parent 7f67f26 commit f4cc84e
Show file tree
Hide file tree
Showing 48 changed files with 47 additions and 136 deletions.
1 change: 1 addition & 0 deletions UPGRADE-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ UPGRADE FROM 1.x to 2.0
* The `MongoDB\Model\IndexInfo::isGeoHaystack` method has been removed.
* The `maxScan`, `modifiers`, `oplogReplay`, and `snapshot` options for `find`
and `findOne` operations have been removed.
* The `MongoDB\Operation\Executable` interface has been removed.

GridFS
------
Expand Down
4 changes: 1 addition & 3 deletions src/Command/ListCollections.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use MongoDB\Driver\Session;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\CachingIterator;
use MongoDB\Operation\Executable;

use function is_bool;
use function is_integer;
Expand All @@ -36,7 +35,7 @@
* @internal
* @see https://mongodb.com/docs/manual/reference/command/listCollections/
*/
final class ListCollections implements Executable
final class ListCollections
{
/**
* Constructs a listCollections command.
Expand Down Expand Up @@ -94,7 +93,6 @@ public function __construct(private string $databaseName, private array $options
* Execute the operation.
*
* @return CachingIterator<int, array>
* @see Executable::execute()
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server): CachingIterator
Expand Down
4 changes: 1 addition & 3 deletions src/Command/ListDatabases.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use MongoDB\Driver\Session;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnexpectedValueException;
use MongoDB\Operation\Executable;

use function current;
use function is_array;
Expand All @@ -37,7 +36,7 @@
* @internal
* @see https://mongodb.com/docs/manual/reference/command/listDatabases/
*/
final class ListDatabases implements Executable
final class ListDatabases
{
/**
* Constructs a listDatabases command.
Expand Down Expand Up @@ -93,7 +92,6 @@ public function __construct(private array $options = [])
/**
* Execute the operation.
*
* @see Executable::execute()
* @return array An array of database info structures
* @throws UnexpectedValueException if the command response was malformed
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/Aggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* @see \MongoDB\Collection::aggregate()
* @see https://mongodb.com/docs/manual/reference/command/aggregate/
*/
final class Aggregate implements Executable, Explainable
final class Aggregate implements Explainable
{
private bool $isWrite;

Expand Down Expand Up @@ -212,7 +212,6 @@ public function __construct(private string $databaseName, private ?string $colle
/**
* Execute the operation.
*
* @see Executable::execute()
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if read concern or write concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/BulkWrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
*
* @see \MongoDB\Collection::bulkWrite()
*/
final class BulkWrite implements Executable
final class BulkWrite
{
public const DELETE_MANY = 'deleteMany';
public const DELETE_ONE = 'deleteOne';
Expand Down Expand Up @@ -185,7 +185,6 @@ public function __construct(private string $databaseName, private string $collec
/**
* Execute the operation.
*
* @see Executable::execute()
* @throws UnsupportedException if write concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/Count.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @see \MongoDB\Collection::count()
* @see https://mongodb.com/docs/manual/reference/command/count/
*/
final class Count implements Executable, Explainable
final class Count implements Explainable
{
/**
* Constructs a count command.
Expand Down Expand Up @@ -124,7 +124,6 @@ public function __construct(private string $databaseName, private string $collec
/**
* Execute the operation.
*
* @see Executable::execute()
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if read concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/CountDocuments.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @see \MongoDB\Collection::countDocuments()
* @see https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#countdocuments
*/
final class CountDocuments implements Executable
final class CountDocuments
{
private array $aggregateOptions;

Expand Down Expand Up @@ -103,7 +103,6 @@ public function __construct(private string $databaseName, private string $collec
/**
* Execute the operation.
*
* @see Executable::execute()
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if collation or read concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/CreateCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @see \MongoDB\Database::createCollection()
* @see https://mongodb.com/docs/manual/reference/command/create/
*/
final class CreateCollection implements Executable
final class CreateCollection
{
public const USE_POWER_OF_2_SIZES = 1;
public const NO_PADDING = 2;
Expand Down Expand Up @@ -239,7 +239,6 @@ public function __construct(private string $databaseName, private string $collec
/**
* Execute the operation.
*
* @see Executable::execute()
* @return array|object Command result document
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/CreateEncryptedCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#create-encrypted-collection-helper
* @see https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/manage-collections/
*/
final class CreateEncryptedCollection implements Executable
final class CreateEncryptedCollection
{
private const WIRE_VERSION_FOR_QUERYABLE_ENCRYPTION_V2 = 21;

Expand Down Expand Up @@ -155,7 +155,6 @@ public function createDataKeys(ClientEncryption $clientEncryption, string $kmsPr
}

/**
* @see Executable::execute()
* @return array|object Command result document from creating the encrypted collection
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
* @throws UnsupportedException if the server does not support Queryable Encryption
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/CreateIndexes.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @see \MongoDB\Collection::createIndexes()
* @see https://mongodb.com/docs/manual/reference/command/createIndexes/
*/
final class CreateIndexes implements Executable
final class CreateIndexes
{
private const WIRE_VERSION_FOR_COMMIT_QUORUM = 9;

Expand Down Expand Up @@ -116,7 +116,6 @@ public function __construct(private string $databaseName, private string $collec
/**
* Execute the operation.
*
* @see Executable::execute()
* @return string[] The names of the created indexes
* @throws UnsupportedException if write concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/CreateSearchIndexes.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @see \MongoDB\Collection::createSearchIndexes()
* @see https://mongodb.com/docs/manual/reference/command/createSearchIndexes/
*/
final class CreateSearchIndexes implements Executable
final class CreateSearchIndexes
{
private array $indexes = [];

Expand Down Expand Up @@ -68,7 +68,6 @@ public function __construct(private string $databaseName, private string $collec
/**
* Execute the operation.
*
* @see Executable::execute()
* @return string[] The names of the created indexes
* @throws UnsupportedException if write concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
Expand Down
7 changes: 1 addition & 6 deletions src/Operation/DatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*
* @see \MongoDB\Database::command()
*/
final class DatabaseCommand implements Executable
final class DatabaseCommand
{
private Command $command;

Expand Down Expand Up @@ -78,11 +78,6 @@ public function __construct(private string $databaseName, array|object $command,
$this->command = $command instanceof Command ? $command : new Command($command);
}

/**
* Execute the operation.
*
* @see Executable::execute()
*/
public function execute(Server $server): CursorInterface
{
$cursor = $server->executeCommand($this->databaseName, $this->command, $this->createOptions());
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* @internal
* @see https://mongodb.com/docs/manual/reference/command/delete/
*/
final class Delete implements Executable, Explainable
final class Delete implements Explainable
{
private const WIRE_VERSION_FOR_HINT = 9;

Expand Down Expand Up @@ -120,7 +120,6 @@ public function __construct(private string $databaseName, private string $collec
/**
* Execute the operation.
*
* @see Executable::execute()
* @throws UnsupportedException if hint or write concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/DeleteMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @see \MongoDB\Collection::deleteOne()
* @see https://mongodb.com/docs/manual/reference/command/delete/
*/
final class DeleteMany implements Executable, Explainable
final class DeleteMany implements Explainable
{
private Delete $delete;

Expand Down Expand Up @@ -74,7 +74,6 @@ public function __construct(string $databaseName, string $collectionName, array|
/**
* Execute the operation.
*
* @see Executable::execute()
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/DeleteOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @see \MongoDB\Collection::deleteOne()
* @see https://mongodb.com/docs/manual/reference/command/delete/
*/
final class DeleteOne implements Executable, Explainable
final class DeleteOne implements Explainable
{
private Delete $delete;

Expand Down Expand Up @@ -74,7 +74,6 @@ public function __construct(string $databaseName, string $collectionName, array|
/**
* Execute the operation.
*
* @see Executable::execute()
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/Distinct.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* @see \MongoDB\Collection::distinct()
* @see https://mongodb.com/docs/manual/reference/command/distinct/
*/
final class Distinct implements Executable, Explainable
final class Distinct implements Explainable
{
/**
* Constructs a distinct command.
Expand Down Expand Up @@ -109,7 +109,6 @@ public function __construct(private string $databaseName, private string $collec
/**
* Execute the operation.
*
* @see Executable::execute()
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if read concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/DropCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @see \MongoDB\Database::dropCollection()
* @see https://mongodb.com/docs/manual/reference/command/drop/
*/
final class DropCollection implements Executable
final class DropCollection
{
private const ERROR_CODE_NAMESPACE_NOT_FOUND = 26;

Expand Down Expand Up @@ -83,7 +83,6 @@ public function __construct(private string $databaseName, private string $collec
/**
* Execute the operation.
*
* @see Executable::execute()
* @return array|object Command result document
* @throws UnsupportedException if write concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/DropDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @see \MongoDB\Database::drop()
* @see https://mongodb.com/docs/manual/reference/command/dropDatabase/
*/
final class DropDatabase implements Executable
final class DropDatabase
{
/**
* Constructs a dropDatabase command.
Expand Down Expand Up @@ -78,7 +78,6 @@ public function __construct(private string $databaseName, private array $options
/**
* Execute the operation.
*
* @see Executable::execute()
* @return array|object Command result document
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/DropEncryptedCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#drop-collection-helper
* @see https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/manage-collections/
*/
final class DropEncryptedCollection implements Executable
final class DropEncryptedCollection
{
private DropCollection $dropCollection;

Expand Down Expand Up @@ -85,7 +85,6 @@ public function __construct(string $databaseName, string $collectionName, array
}

/**
* @see Executable::execute()
* @return array|object Command result document from dropping the encrypted collection
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/DropIndexes.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @see \MongoDB\Collection::dropIndexes()
* @see https://mongodb.com/docs/manual/reference/command/dropIndexes/
*/
final class DropIndexes implements Executable
final class DropIndexes
{
/**
* Constructs a dropIndexes command.
Expand Down Expand Up @@ -92,7 +92,6 @@ public function __construct(private string $databaseName, private string $collec
/**
* Execute the operation.
*
* @see Executable::execute()
* @return array|object Command result document
* @throws UnsupportedException if write concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/DropSearchIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @see \MongoDB\Collection::dropSearchIndexes()
* @see https://mongodb.com/docs/manual/reference/command/dropSearchIndexes/
*/
final class DropSearchIndex implements Executable
final class DropSearchIndex
{
private const ERROR_CODE_NAMESPACE_NOT_FOUND = 26;

Expand All @@ -53,7 +53,6 @@ public function __construct(private string $databaseName, private string $collec
/**
* Execute the operation.
*
* @see Executable::execute()
* @throws UnsupportedException if write concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Operation/EstimatedDocumentCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @see \MongoDB\Collection::estimatedDocumentCount()
* @see https://mongodb.com/docs/manual/reference/command/count/
*/
final class EstimatedDocumentCount implements Executable, Explainable
final class EstimatedDocumentCount implements Explainable
{
private array $options;

Expand Down Expand Up @@ -87,7 +87,6 @@ public function __construct(private string $databaseName, private string $collec
/**
* Execute the operation.
*
* @see Executable::execute()
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if collation or read concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
Expand Down
Loading

0 comments on commit f4cc84e

Please sign in to comment.