protected function JsonItemTest::getTableData in JSON Field 8
Gets all data from a given table.
If a table is set to be schema only, and empty array is returned.
Parameters
\Drupal\Core\Database\Connection $connection: The database connection to use.
string $table: The table to query.
Return value
array The data from the table as an array.
File
- tests/
src/ Kernel/ JsonItemTest.php, line 307  
Class
- JsonItemTest
 - @coversDefaultClass \Drupal\json_field\Plugin\Field\FieldType\JSONItem
 
Namespace
Drupal\Tests\json_field\KernelCode
protected function getTableData(Connection $connection, $table) {
  $order = $this
    ->getFieldOrder($connection, $table);
  $query = $connection
    ->query("SELECT * FROM {" . $table . "} " . $order);
  $results = [];
  while (($row = $query
    ->fetchAssoc()) !== FALSE) {
    $results[] = $row;
  }
  return $results;
}