| @@ 201-215 (lines=15) @@ | ||
| 198 | * |
|
| 199 | * @return int |
|
| 200 | */ |
|
| 201 | public function count() |
|
| 202 | { |
|
| 203 | if ($this->queryShouldBeStopped) { |
|
| 204 | return 0; |
|
| 205 | } |
|
| 206 | ||
| 207 | $filter = $this->normalizeFilter(); |
|
| 208 | $queryType = "ElementQuery::count"; |
|
| 209 | ||
| 210 | $callback = function () use ($filter) { |
|
| 211 | return (int) $this->bxObject->GetList(false, $filter, []); |
|
| 212 | }; |
|
| 213 | ||
| 214 | return $this->handleCacheIfNeeded(compact('filter', 'queryType'), $callback); |
|
| 215 | } |
|
| 216 | ||
| 217 | // /** |
|
| 218 | // * Normalize properties's format converting it to 'PROPERTY_"CODE"_VALUE'. |
|
| @@ 145-158 (lines=14) @@ | ||
| 142 | * |
|
| 143 | * @return int |
|
| 144 | */ |
|
| 145 | public function count() |
|
| 146 | { |
|
| 147 | if ($this->queryShouldBeStopped) { |
|
| 148 | return 0; |
|
| 149 | } |
|
| 150 | ||
| 151 | $queryType = 'SectionQuery::count'; |
|
| 152 | $filter = $this->normalizeFilter(); |
|
| 153 | $callback = function() use ($filter) { |
|
| 154 | return (int) $this->bxObject->getCount($filter); |
|
| 155 | }; |
|
| 156 | ||
| 157 | return $this->handleCacheIfNeeded(compact('queryType', 'filter'), $callback); |
|
| 158 | } |
|
| 159 | ||
| 160 | /** |
|
| 161 | * Setter for countElements. |
|