You are here

public function DB::fetch_all in Anti Spam by CleanTalk 9.1.x

Same name in this branch
  1. 9.1.x src/lib/Cleantalk/Common/DB.php \Cleantalk\Common\DB::fetch_all()
  2. 9.1.x src/lib/Cleantalk/ApbctDrupal/DB.php \Cleantalk\ApbctDrupal\DB::fetch_all()
Same name and namespace in other branches
  1. 8.4 src/lib/Cleantalk/ApbctDrupal/DB.php \Cleantalk\ApbctDrupal\DB::fetch_all()

Fetchs all result from query. May receive raw or prepared query.

Parameters

bool $query:

bool $response_type:

Return value

array|object|null

Overrides DB::fetch_all

File

src/lib/Cleantalk/ApbctDrupal/DB.php, line 76

Class

DB

Namespace

Cleantalk\ApbctDrupal

Code

public function fetch_all($query = false, $response_type = false) {
  $this->db_result = \Drupal::service('database')
    ->query($query);
  $this->result = array();
  while ($row = $this->db_result
    ->fetchAssoc()) {
    $this->result[] = $row;
  }
  return $this->result;
}