Closed mruz closed 4 years ago
Count elements to avoid fetching all.
For PDO we could use findOne and specify total as field:
public function count(array $filters = []): int { $result = $this->getDb()->findOne($this->model->from, $filters, [], ['count(*) AS total']); return $result ? (int) $result->total : 0; }
Count elements to avoid fetching all.
For PDO we could use findOne and specify total as field: