3939use function trim ;
4040
4141/**
42- * Query represents a SELECT SQL statement in a way that is independent of DBMS.
42+ * Represents a SELECT SQL statement in a way that's independent of DBMS.
4343 *
44- * Query provides a set of methods to facilitate the specification of different clauses in a SELECT statement. These
45- * methods can be chained together.
44+ * Provides a set of methods to ease the specification of different clauses in a SELECT statement.
4645 *
47- * By calling {@see createCommand()}, we can get a {@see Command} instance which can be further used to perform/execute
48- * the DB query against a database.
46+ * These methods can be chained together.
47+ *
48+ * By calling {@see createCommand()}, we can get a {@see CommandInterface} instance which can be further used to
49+ * perform/execute the DB query against a database.
4950 *
5051 * For example,
5152 *
5253 * ```php
5354 * $query = new Query;
55+ *
5456 * // compose the query
55- * $query->select('id, name')
56- * ->from('user')
57- * ->limit(10);
57+ * $query->select('id, name')->from('user')->limit(10);
58+ *
5859 * // build and execute the query
5960 * $rows = $query->all();
61+ *
6062 * // alternatively, you can create DB command and execute it
6163 * $command = $query->createCommand();
64+ *
6265 * // $command->sql returns the actual SQL
6366 * $rows = $command->queryAll();
6467 * ```
6568 *
66- * Query internally uses the {@see QueryBuilder} class to generate the SQL statement.
69+ * Query internally uses the {@see \Yiisoft\Db\ QueryBuilder\AbstractQueryBuilder } class to generate the SQL statement.
6770 */
6871class Query implements QueryInterface
6972{
@@ -82,6 +85,7 @@ class Query implements QueryInterface
8285 protected ExpressionInterface |int |null $ limit = null ;
8386 protected ExpressionInterface |int |null $ offset = null ;
8487 protected array |string |ExpressionInterface |null $ where = null ;
88+ protected array $ with = [];
8589
8690 private bool $ emulateExecution = false ;
8791
@@ -678,7 +682,7 @@ public function withQueries(array $withQueries): static
678682 }
679683
680684 /**
681- * Queries a scalar value by setting {@see select} first.
685+ * Queries a scalar value by setting {@see select() } first.
682686 *
683687 * Restores the value of select to make this query reusable.
684688 *
@@ -731,11 +735,11 @@ protected function queryScalar(string|ExpressionInterface $selectExpression): bo
731735 }
732736
733737 /**
734- * Removes {@see isEmpty()|empty operands } from the given query condition.
738+ * Removes {@see Query:: isEmpty()} from the given query condition.
735739 *
736740 * @param array|string $condition The original condition.
737741 *
738- * @return array|string The condition with {@see isEmpty()|empty operands } removed.
742+ * @return array|string The condition with {@see Query:: isEmpty()} removed.
739743 */
740744 private function filterCondition (array |string $ condition ): array |string
741745 {
@@ -745,7 +749,7 @@ private function filterCondition(array|string $condition): array|string
745749
746750 if (!isset ($ condition [0 ])) {
747751 /**
748- * hash format: 'column1' => 'value1', 'column2' => 'value2', ...
752+ * Hash format: 'column1' => 'value1', 'column2' => 'value2', ...
749753 *
750754 * @psalm-var mixed $value
751755 */
@@ -759,7 +763,7 @@ private function filterCondition(array|string $condition): array|string
759763 }
760764
761765 /**
762- * operator format: operator, operand 1, operand 2, ...
766+ * Operator format: operator, operand 1, operand 2, ...
763767 *
764768 * @psalm-var string $operator
765769 */
@@ -809,11 +813,11 @@ private function filterCondition(array|string $condition): array|string
809813 /**
810814 * Returns a value indicating whether the give value is "empty".
811815 *
812- * The value is considered "empty", if one of the following conditions is satisfied:
816+ * The value is considered "empty" if one of the following conditions is satisfied:
813817 *
814- * - it is `null`,
818+ * - It's `null`,
815819 * - an empty string (`''`),
816- * - a string containing only whitespace characters,
820+ * - a string containing only space characters,
817821 * - or an empty array.
818822 *
819823 * @param mixed $value The value to be checked.
@@ -826,11 +830,11 @@ private function isEmpty(mixed $value): bool
826830 }
827831
828832 /**
829- * Normalizes format of ORDER BY data.
833+ * Normalizes a format of ORDER BY data.
830834 *
831835 * @param array|ExpressionInterface|string $columns The columns value to normalize.
832836 *
833- * See {@see orderBy} and {@see addOrderBy}.
837+ * See {@see orderBy() } and {@see addOrderBy() }.
834838 */
835839 private function normalizeOrderBy (array |string |ExpressionInterface $ columns ): array
836840 {
0 commit comments