Hi Steve,
I have a couple more queries and ideas from one of our developers. First some context:
The original error in question was returning a problem on
line 311 of the relevant report class in AtoM. In that file, we fetch the physical object relations based on the object table (see lines 249-254), and then we try to get the related record (either description or accession) using ID - for descriptions, see for example line 300.
In AtoM, most main entities have a row in the root object table, where they are given an object ID - and then the rest of their metadata is stored in other database tables, such as information_object and information_object_i18n for descriptions.
If you have rows where the information object (i.e. description) table data has been deleted, but a partial object table row, then this error might arise. This shouldn't normally happen in AtoM - but could if someone tried using SQL to delete directly from the information object tables for example, or a few other edge cases.
Either way, we can check if this is the case, and also delete any object rows that are linked to descriptions or accessions but have no ID, with the following queries.
First, we always recommend
making some backups before accessing the MySQL command-prompt. Instructions on how to access the MySQL command prompt can be found here:
Now, let's check for any descriptions and accessions for records that have a null ID:
SELECT obj.id
FROM object obj
LEFT JOIN information_object io ON obj.id=io.id
WHERE obj.class_name='QubitInformationObject'
AND io.id IS NULL;
and
SELECT obj.id
FROM object obj
LEFT JOIN accession acc ON obj.id=acc.id
WHERE obj.class_name='QubitAccession'
AND acc.id IS NULL;
If these queries do return records, then you can use the following examples to delete these:
DELETE obj
FROM object obj
LEFT JOIN information_object io ON obj.id=io.id
WHERE obj.class_name='QubitInformationObject'
AND io.id IS NULL;
and
DELETE obj
FROM object obj
LEFT JOIN accession acc ON obj.id=acc.id
WHERE obj.class_name='QubitAccession'
AND acc.id IS NULL;
If you do find anything, I'd recommend re-running the tasks I recommended previously (nested set, slugs, cache clear, repopulate search index) before re-testing.
Let us know how it goes!