| @@ 220-234 (lines=15) @@ | ||
| 217 | * |
|
| 218 | * @return int |
|
| 219 | */ |
|
| 220 | public function count() |
|
| 221 | { |
|
| 222 | if ($this->queryShouldBeStopped) { |
|
| 223 | return 0; |
|
| 224 | } |
|
| 225 | ||
| 226 | $filter = $this->normalizeFilter(); |
|
| 227 | $queryType = "ElementQuery::count"; |
|
| 228 | ||
| 229 | $callback = function () use ($filter) { |
|
| 230 | return (int) $this->bxObject->GetList(false, $filter, []); |
|
| 231 | }; |
|
| 232 | ||
| 233 | return $this->handleCacheIfNeeded(compact('filter', 'queryType'), $callback); |
|
| 234 | } |
|
| 235 | ||
| 236 | // /** |
|
| 237 | // * Normalize properties's format converting it to 'PROPERTY_"CODE"_VALUE'. |
|
| @@ 156-169 (lines=14) @@ | ||
| 153 | * |
|
| 154 | * @return int |
|
| 155 | */ |
|
| 156 | public function count() |
|
| 157 | { |
|
| 158 | if ($this->queryShouldBeStopped) { |
|
| 159 | return 0; |
|
| 160 | } |
|
| 161 | ||
| 162 | $queryType = 'SectionQuery::count'; |
|
| 163 | $filter = $this->normalizeFilter(); |
|
| 164 | $callback = function() use ($filter) { |
|
| 165 | return (int) $this->bxObject->getCount($filter); |
|
| 166 | }; |
|
| 167 | ||
| 168 | return $this->handleCacheIfNeeded(compact('queryType', 'filter'), $callback); |
|
| 169 | } |
|
| 170 | ||
| 171 | /** |
|
| 172 | * Setter for countElements. |
|