Skip to content

Refactor/301 qbmapper - #304

Merged
Martin-1997 merged 2 commits into
masterfrom
refactor/301-qbmapper
Nov 10, 2026
Merged

Martin-1997 merged 2 commits into
masterfrom
refactor/301-qbmapper

Conversation

@Martin-1997

Copy link
Copy Markdown
Collaborator

No description provided.

Martin-1997 and others added 2 commits November 10, 2026 18:41
Covers every mapper method the app uses (find, search, insert, update,
delete, and the per-project/per-user queries) on the real database, so the
migration to QBMapper can be checked against the current behaviour on
SQLite, MySQL/MariaDB and PostgreSQL.

Refs #301

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015KJpM1wJdw3Uxw5p86uRBD
In 2023 (#210) the removed OCP\AppFramework\Db\Mapper was replaced by a
copy of its old code (OldNextcloudMapper), aliased as CompatibleMapper.
All mappers now extend Nextcloud's QBMapper and build their queries with
the query builder, so the copy and the alias are gone.

Behaviour stays the same: every public method keeps its name, arguments
and results, including which lookups return null and which throw
DoesNotExistException. The new integration tests pass unchanged on
SQLite, MySQL/MariaDB and PostgreSQL, before and after.

Details:
- ProjectMapper::delete($id) clashed with QBMapper::delete(Entity) and is
  now deleteById($id).
- TagMapper::allowedTags() no longer needs database-specific SQL for the
  current time; it uses time().
- Name searches escape % and _ in the search text, so they match literally.
- ReportItemMapper only builds reports and isn't a table mapper; it is now
  a plain class using the query builder.
- Removed code that could not work: WorkItem/WorkItemMapper (their table
  doesn't exist), WorkIntervalMapper::stopAllRunning() (invalid SQL) and
  ::findAllForWorkItem() (column doesn't exist), and the unused
  WorkIntervalMapper::findByName().
- The PHPStan bootstrap that mirrored the alias and the baseline entries
  for the old mapper code are removed.

Fixes #301

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015KJpM1wJdw3Uxw5p86uRBD
@Martin-1997
Martin-1997 merged commit 9162bf5 into master Nov 10, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant