Skip to content

Commit b5d05e8

Browse files
committed
Deprecate Query Builder's group method
1 parent b5d0c89 commit b5d05e8

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

docs/en/reference/aggregation-builder.rst

+2
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ You can also use fields defined in previous stages:
281281
->field('purchaseYear')
282282
->equals(2016);
283283
284+
.. _aggregation_builder_group:
285+
284286
$group
285287
~~~~~~
286288

docs/en/reference/query-builder-api.rst

+7
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,13 @@ Here is an example where we remove users who have never logged in:
946946
Group Queries
947947
-------------
948948

949+
.. note::
950+
951+
Due to deprecation of ``group`` command in MongoDB 3.4 the ODM
952+
also deprecates its usage through Query Builder in 1.2. Please
953+
use :ref:`$group stage <aggregation_builder_group>` of the
954+
Aggregation Builder instead.
955+
949956
The last type of supported query is a group query. It performs an
950957
operation similar to SQL's GROUP BY command.
951958

lib/Doctrine/ODM/MongoDB/Query/Builder.php

+13
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,19 @@ public function includesReferenceTo($document)
343343
return $this;
344344
}
345345

346+
/**
347+
* @inheritdoc
348+
* @deprecated Deprecated in version 1.2 - use Aggregation Builder's group stage instead.
349+
*/
350+
public function group($keys, array $initial, $reduce = null, array $options = [])
351+
{
352+
@trigger_error(
353+
sprintf('%s was deprecated in version 1.2 - use Aggregation Builder\'s group stage instead.', __METHOD__),
354+
E_USER_DEPRECATED
355+
);
356+
return parent::group($keys, $initial, $reduce, $options);
357+
}
358+
346359
/**
347360
* Gets the Query executable.
348361
*

0 commit comments

Comments
 (0)