Commit 67cad14d authored by Jeremy Mikola's avatar Jeremy Mikola

Take Manager as first ctor arg in Watch operation

This makes the constructor consistent with other classes (e.g. Client, GridFS\Bucket) and also ensures that we don't have required parameters trailing optional arguments (i.e. options array).
parent 9867b4eb
...@@ -960,7 +960,7 @@ class Collection ...@@ -960,7 +960,7 @@ class Collection
$options['readConcern'] = $this->readConcern; $options['readConcern'] = $this->readConcern;
} }
$operation = new Watch($this->databaseName, $this->collectionName, $pipeline, $options, $this->manager); $operation = new Watch($this->manager, $this->databaseName, $this->collectionName, $pipeline, $options);
return $operation->execute($server); return $operation->execute($server);
} }
......
...@@ -91,7 +91,7 @@ class Watch implements Executable ...@@ -91,7 +91,7 @@ class Watch implements Executable
* @param Manager $manager Manager instance from the driver * @param Manager $manager Manager instance from the driver
* @throws InvalidArgumentException for parameter/option parsing errors * @throws InvalidArgumentException for parameter/option parsing errors
*/ */
public function __construct($databaseName, $collectionName, array $pipeline, array $options = [], Manager $manager) public function __construct(Manager $manager, $databaseName, $collectionName, array $pipeline, array $options = [])
{ {
if (isset($options['batchSize']) && ! is_integer($options['batchSize'])) { if (isset($options['batchSize']) && ! is_integer($options['batchSize'])) {
throw InvalidArgumentException::invalidType('"batchSize" option', $options['batchSize'], 'integer'); throw InvalidArgumentException::invalidType('"batchSize" option', $options['batchSize'], 'integer');
...@@ -119,11 +119,11 @@ class Watch implements Executable ...@@ -119,11 +119,11 @@ class Watch implements Executable
} }
} }
$this->manager = $manager;
$this->databaseName = (string) $databaseName; $this->databaseName = (string) $databaseName;
$this->collectionName = (string) $collectionName; $this->collectionName = (string) $collectionName;
$this->pipeline = $pipeline; $this->pipeline = $pipeline;
$this->options = $options; $this->options = $options;
$this->manager = $manager;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment