+
+ @classmethod
+ def all(cls: type[BaseModelInstance],
+ db_conn: DatabaseConnection) -> list[BaseModelInstance]:
+ """Collect all objects of class."""
+ items: dict[BaseModelId, BaseModelInstance] = {}
+ for k, v in cls.cache_.items():
+ assert isinstance(v, cls)
+ items[k] = v
+ already_recorded = items.keys()
+ for id_ in db_conn.column_all(cls.table_name, 'id'):
+ if id_ not in already_recorded:
+ # pylint: disable=no-member
+ item = cls.by_id(db_conn, id_) # type: ignore[attr-defined]
+ items[item.id_] = item
+ return list(items.values())