| @@ 72-89 (lines=18) @@ | ||
| 69 | * @param array|Expr $expression |
|
| 70 | * @return $this |
|
| 71 | */ |
|
| 72 | public function addAnd($expression /*, $expression2, ... */) |
|
| 73 | { |
|
| 74 | if (! isset($this->query['$and'])) { |
|
| 75 | $this->query['$and'] = []; |
|
| 76 | } |
|
| 77 | ||
| 78 | $this->query['$and'] = array_merge( |
|
| 79 | $this->query['$and'], |
|
| 80 | array_map( |
|
| 81 | function ($expression) { |
|
| 82 | return $expression instanceof Expr ? $expression->getQuery() : $expression; |
|
| 83 | }, |
|
| 84 | func_get_args() |
|
| 85 | ) |
|
| 86 | ); |
|
| 87 | ||
| 88 | return $this; |
|
| 89 | } |
|
| 90 | ||
| 91 | /** |
|
| 92 | * Append multiple values to the current array field only if they do not |
|
| @@ 121-133 (lines=13) @@ | ||
| 118 | * @param array|Expr $expression |
|
| 119 | * @return $this |
|
| 120 | */ |
|
| 121 | public function addNor($expression /* , $expression2, ... */) |
|
| 122 | { |
|
| 123 | if (! isset($this->query['$nor'])) { |
|
| 124 | $this->query['$nor'] = []; |
|
| 125 | } |
|
| 126 | ||
| 127 | $this->query['$nor'] = array_merge( |
|
| 128 | $this->query['$nor'], |
|
| 129 | array_map(function ($expression) { return $expression instanceof Expr ? $expression->getQuery() : $expression; }, func_get_args()) |
|
| 130 | ); |
|
| 131 | ||
| 132 | return $this; |
|
| 133 | } |
|
| 134 | ||
| 135 | /** |
|
| 136 | * Add one or more $or clauses to the current query. |
|
| @@ 143-155 (lines=13) @@ | ||
| 140 | * @param array|Expr $expression |
|
| 141 | * @return $this |
|
| 142 | */ |
|
| 143 | public function addOr($expression /* , $expression2, ... */) |
|
| 144 | { |
|
| 145 | if (! isset($this->query['$or'])) { |
|
| 146 | $this->query['$or'] = []; |
|
| 147 | } |
|
| 148 | ||
| 149 | $this->query['$or'] = array_merge( |
|
| 150 | $this->query['$or'], |
|
| 151 | array_map(function ($expression) { return $expression instanceof Expr ? $expression->getQuery() : $expression; }, func_get_args()) |
|
| 152 | ); |
|
| 153 | ||
| 154 | return $this; |
|
| 155 | } |
|
| 156 | ||
| 157 | /** |
|
| 158 | * Append one or more values to the current array field only if they do not |
|