protected function getEntityCountQuery($filters) { // this is very basic and assumes you are searching just on name $where = ''; if (array_key_exists('name', $filters)) { // use name $where = ' and name like ' . Database::queryStringWildcard($filters['name']); } $query = 'select count(*) from ' . lcfirst($this->getName()) . ' where tenantid=' . $this->tenantid . $where; return $query; }