diff --git a/core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php b/core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php index c696449..35bc2fd 100644 --- a/core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php +++ b/core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php @@ -36,7 +36,7 @@ public function __construct(StorageInterface $config_storage) { } /** - * Instantiate a entity query for a certain entity type. + * Instantiates an entity query for a given entity type. * * @param string $entity_type * The entity type for the query. diff --git a/core/lib/Drupal/Core/Entity/Query/QueryAggregateInterface.php b/core/lib/Drupal/Core/Entity/Query/QueryAggregateInterface.php index 4cab897..486c246 100644 --- a/core/lib/Drupal/Core/Entity/Query/QueryAggregateInterface.php +++ b/core/lib/Drupal/Core/Entity/Query/QueryAggregateInterface.php @@ -13,8 +13,9 @@ interface QueryAggregateInterface extends QueryInterface { /** - * Specify a field and a function to aggregate on. Available functions: - * SUM, AVG, MIN, MAX and COUNT. + * Specifies a field and a function to aggregate on. + * + * Available functions: SUM, AVG, MIN, MAX and COUNT. * * @todo What about GROUP_CONCAT support? * @@ -33,7 +34,7 @@ public function aggregate($field, $function, $langcode = NULL, &$alias = NULL); /** - * Specify the field to group on. + * Specifies the field to group on. * * @param string $field * The name of the field to group by. @@ -44,7 +45,7 @@ public function aggregate($field, $function, $langcode = NULL, &$alias = NULL); public function groupBy($field); /** - * Set a condition for an aggregated value. + * Sets a condition for an aggregated value. * * @param string $field * The name of the field to aggregate by. diff --git a/core/lib/Drupal/Core/Entity/Query/QueryBase.php b/core/lib/Drupal/Core/Entity/Query/QueryBase.php index 9748f4c..c3c6932 100644 --- a/core/lib/Drupal/Core/Entity/Query/QueryBase.php +++ b/core/lib/Drupal/Core/Entity/Query/QueryBase.php @@ -38,7 +38,7 @@ /** * Conditions. * - * @var ConditionInterface + * @var \Drupal\Core\Entity\Query\ConditionInterface */ protected $condition; @@ -59,7 +59,7 @@ /** * Aggregate Conditions * - * @var ConditionAggregateInterface + * @var \Drupal\Core\Entity\Query\ConditionAggregateInterface */ protected $conditionAggregate; diff --git a/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Query.php b/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Query.php index cfb8393..9d8ab5d 100644 --- a/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Query.php +++ b/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Query.php @@ -260,7 +260,7 @@ protected function finish() { } /** - * Creates the result by executing the query and return the result. + * Executes the query and returns the result. * * @return int|array * Returns the query result as entity IDs. @@ -289,7 +289,7 @@ protected function getSqlField($field, $langcode) { } /** - * Does the query requires GROUP BY and ORDER BY MIN/MAX. + * Returns whether the query requires GROUP BY and ORDER BY MIN/MAX. * * @return bool */ @@ -300,7 +300,7 @@ protected function isSimpleQuery() { /** * Implements the magic __clone method. * - * Zero out fields and GROUP BY when cloning. + * Reset fields and GROUP BY when cloning. */ public function __clone() { parent::__clone(); diff --git a/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/QueryAggregate.php b/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/QueryAggregate.php index 3b005eb..c8bbb81 100644 --- a/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/QueryAggregate.php +++ b/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/QueryAggregate.php @@ -23,7 +23,7 @@ class QueryAggregate extends Query implements QueryAggregateInterface { protected $sqlExpressions = array(); /** - * Implements \Drupal\Core\Entity\Query\QueryAggregateInterface::execute() + * Implements \Drupal\Core\Entity\Query\QueryAggregateInterface::execute(). */ public function execute() { return $this @@ -49,7 +49,7 @@ public function prepare() { } /** - * Implements \Drupal\Core\Entity\Query\QueryAggregateInterface::conditionAggregateGroupFactory() + * Implements \Drupal\Core\Entity\Query\QueryAggregateInterface::conditionAggregateGroupFactory(). */ public function conditionAggregateGroupFactory($conjunction = 'AND') { return new ConditionAggregate($conjunction); diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryAggregateTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryAggregateTest.php index e039b00..b957675 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryAggregateTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryAggregateTest.php @@ -66,8 +66,6 @@ protected function setUp() { $this->factory = $this->container->get('entity.query'); // Add some fieldapi fields to be used in the test. - - // @todo Maybe start from 0. for ($i = 1; $i <= 2; $i++) { $field = array( 'field_name' => 'field_test_' . $i, @@ -139,7 +137,7 @@ protected function setUp() { * Test aggregation support. */ public function testAggregation() { - // Apply just a simple groupby. + // Apply a simple groupby. $this->queryResult = $this->factory->getAggregate('entity_test') ->groupBy('user_id') ->execute(); @@ -157,7 +155,7 @@ public function testAggregation() { $function_expected['sum'] = array(array('id_sum' => 21)); $function_expected['avg'] = array(array('id_avg' => (21.0/6.0))); - // Apply just a simple aggregation for different aggregation functions. + // Apply a simple aggregation for different aggregation functions. foreach ($function_expected as $aggregation_function => $expected) { $this->queryResult = $this->factory->getAggregate('entity_test') ->aggregate('id', $aggregation_function) @@ -255,7 +253,7 @@ public function testAggregation() { array('user_id' => 2, 'id_count' => 3), )); - // Apply aggregation, groupby, a aggregation condition and a sort with the + // Apply aggregation, groupby, an aggregation condition and a sort with the // operator '='. $this->queryResult = $this->factory->getAggregate('entity_test') ->aggregate('id', 'COUNT') @@ -265,7 +263,7 @@ public function testAggregation() { ->execute(); $this->assertSortedResults(array(array('id_count' => 2, 'user_id' => 3))); - // Apply aggregation, groupby, a aggregation condition and a sort with the + // Apply aggregation, groupby, an aggregation condition and a sort with the // operator '<' and order ASC. $this->queryResult = $this->factory->getAggregate('entity_test') ->aggregate('id', 'COUNT') @@ -278,7 +276,7 @@ public function testAggregation() { array('id_count' => 2, 'user_id' => 3), )); - // Apply aggregation, groupby, a aggregation condition and a sort with the + // Apply aggregation, groupby, an aggregation condition and a sort with the // operator '<' and order DESC. $this->queryResult = $this->factory->getAggregate('entity_test') ->aggregate('id', 'COUNT') @@ -385,7 +383,7 @@ public function testAggregation() { array('field_test_1' => 3, 'field_test_2_count' => 1, 'field_test_2_sum' => 8), )); - // Apply a aggregate condition for a fieldapi field and group by a simple + // Apply an aggregate condition for a fieldapi field and group by a simple // property. $this->queryResult = $this->factory->getAggregate('entity_test') ->conditionAggregate('field_test_1', 'COUNT', 3) @@ -406,7 +404,7 @@ public function testAggregation() { array('user_id' => 3, 'field_test_1_sum' => 5, 'field_test_1_count' => 2), )); - // Apply a aggregate condition for a simple property and a group by a + // Apply an aggregate condition for a simple property and a group by a // fieldapi field. $this->queryResult = $this->factory->getAggregate('entity_test') ->conditionAggregate('user_id', 'COUNT', 2) @@ -425,7 +423,7 @@ public function testAggregation() { array('field_test_1' => 2, 'user_id_count' => 3), )); - // Apply a aggregate condition and a group by fieldapi fields. + // Apply an aggregate condition and a group by fieldapi fields. $this->queryResult = $this->factory->getAggregate('entity_test') ->groupBy('field_test_1') ->conditionAggregate('field_test_2', 'COUNT', 2) @@ -442,7 +440,7 @@ public function testAggregation() { array('field_test_1' => 2, 'field_test_2_count' => 3), )); - // Apply a aggregate condition and a group by fieldapi fields with multiple + // Apply an aggregate condition and a group by fieldapi fields with multiple // conditions via AND. $this->queryResult = $this->factory->getAggregate('entity_test') ->groupBy('field_test_1') @@ -451,7 +449,7 @@ public function testAggregation() { ->execute(); $this->assertResults(array()); - // Apply a aggregate condition and a group by fieldapi fields with multiple + // Apply an aggregate condition and a group by fieldapi fields with multiple // conditions via OR. $this->queryResult = $this->factory->getAggregate('entity_test', 'OR') ->groupBy('field_test_1') @@ -463,8 +461,8 @@ public function testAggregation() { array('field_test_1' => 3, 'field_test_2_count' => 1, 'field_test_2_sum' => 8), )); - // Group by a normal property and aggregate a fieldapi field and sort by - // the groupby field. + // Group by a normal property and aggregate a fieldapi field and sort by the + // groupby field. $this->queryResult = $this->factory->getAggregate('entity_test') ->aggregate('field_test_1', 'COUNT') ->groupBy('user_id') @@ -497,8 +495,8 @@ public function testAggregation() { array('user_id' => 3, 'field_test_1_count' => 2), )); - // Group by a normal property and aggregate a fieldapi field and sort by - // the aggregated field. + // Group by a normal property, aggregate a fieldapi field, and sort by the + // aggregated field. $this->queryResult = $this->factory->getAggregate('entity_test') ->sortAggregate('field_test_1', 'COUNT', 'DESC') ->groupBy('user_id') @@ -519,7 +517,7 @@ public function testAggregation() { array('user_id' => 2, 'field_test_1_count' => 3), )); - // Group by and aggregate by fieldapi fields and sort by the groupby field. + // Group by and aggregate by fieldapi field, and sort by the groupby field. $this->queryResult = $this->factory->getAggregate('entity_test') ->groupBy('field_test_1') ->aggregate('field_test_2', 'COUNT') @@ -542,7 +540,7 @@ public function testAggregation() { array('field_test_1' => 1, 'field_test_2_count' => 2), )); - // Groupy and aggregate by fieldapi fields and sort by the aggregated field. + // Groupy and aggregate by fieldapi field, and sort by the aggregated field. $this->queryResult = $this->factory->getAggregate('entity_test') ->groupBy('field_test_1') ->sortAggregate('field_test_2', 'COUNT', 'DESC')