mjordan / islandora_repository_reports

A Drupal 8 module that provides a collection of graphical reports on various aspects of an Islandora repository.
GNU General Public License v2.0
2 stars 5 forks source link

PUID data source thows error #2

Open mjordan opened 4 years ago

mjordan commented 4 years ago

As of https://github.com/roblib/islandora_fits/commit/004f269ebfe50462eff9a592a9e76c5fe9f115bf, fields from the FITS data are not being added to media, so our query on fits_droid_puid fails with:

[Sat Apr 25 15:50:46.015467 2020] [php7:notice] [pid 2711] [client 10.0.2.2:41652] Uncaught PHP Exception Drupal\\Core\\Entity\\Query\\QueryException: "'fits_droid_puid' not found" at /var/www/html/drupal/web/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php line 367, referer: http://localhost:8000/admin/reports/media_formats

The best way to check whether a field exists is using code like:

  $schema = \Drupal\Core\Database\Database::getConnection()->schema();
  $tables = rest_oai_pmh_schema();
  foreach ($tables as $name => $table) {
    if (!$schema->tableExists($name)) {
      $schema->createTable($name, $table);
    }
  }

The Islandora FITS module doesn't provide a schema, since the fields are dynamically generated. So, in the absense of the fits_droid_puid field, the current PUID data source won't work.

mjordan commented 4 years ago

Once I figure out how to test for the presence of the fits_droid_puid field in the absence of a schema, I can put back the PUID data source.