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