listTables() public method

public listTables ( array $args = [] ) : array
$args array
return array
Example #1
0
 /**
  * Fetches tables in the dataset.
  *
  * Example:
  * ```
  * $tables = $dataset->tables();
  *
  * foreach ($tables as $table) {
  *     var_dump($table->id());
  * }
  * ```
  *
  * @see https://cloud.google.com/bigquery/docs/reference/v2/tables/list Tables list API documentation.
  *
  * @param array $options [optional] {
  *     Configuration options.
  *
  *     @type int $maxResults Maximum number of results to return.
  * }
  * @return \Generator<Google\Cloud\BigQuery\Table>
  */
 public function tables(array $options = [])
 {
     $options['pageToken'] = null;
     do {
         $response = $this->connection->listTables($options + $this->identity);
         if (!isset($response['tables'])) {
             return;
         }
         foreach ($response['tables'] as $table) {
             (yield new Table($this->connection, $table['tableReference']['tableId'], $this->identity['datasetId'], $this->identity['projectId'], $table));
         }
         $options['pageToken'] = isset($response['nextPageToken']) ? $response['nextPageToken'] : null;
     } while ($options['pageToken']);
 }