From 4dfb6997e9318a25a5c441755dc4ba7af3540743 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 18 Oct 2016 12:33:41 -0700 Subject: [PATCH] Allow BatchRowIterator to also set query options. Change-Id: I15927c5b7f1edcfb40edd3cda9257b40d0276073 --- includes/utils/BatchRowIterator.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/includes/utils/BatchRowIterator.php b/includes/utils/BatchRowIterator.php index 602587ce45..ef2c14a9b7 100644 --- a/includes/utils/BatchRowIterator.php +++ b/includes/utils/BatchRowIterator.php @@ -77,6 +77,11 @@ class BatchRowIterator implements RecursiveIterator { */ private $key; + /** + * @var array Additional query options + */ + protected $options = []; + /** * @param IDatabase $db The database to read from * @param string|array $table The name or names of the table to read from @@ -104,6 +109,14 @@ class BatchRowIterator implements RecursiveIterator { $this->conditions = array_merge( $this->conditions, $conditions ); } + /** + * @param array $options Query options suitable for use with + * IDatabase::select + */ + public function addOptions( array $options ) { + $this->options = array_merge( $this->options, $options ); + } + /** * @param array $conditions Query join conditions suitable for use * with IDatabase::select @@ -199,7 +212,7 @@ class BatchRowIterator implements RecursiveIterator { [ 'LIMIT' => $this->batchSize, 'ORDER BY' => $this->orderBy, - ], + ] + $this->options, $this->joinConditions ); -- 2.20.1