Skip to content

Adopt Scope rename, remove dead code, simplify Db#118

Merged
alganet merged 1 commit intoRespect:masterfrom
alganet:scope
Apr 4, 2026
Merged

Adopt Scope rename, remove dead code, simplify Db#118
alganet merged 1 commit intoRespect:masterfrom
alganet:scope

Conversation

@alganet
Copy link
Copy Markdown
Member

@alganet alganet commented Apr 4, 2026

  • Update all imports and type hints from Collection to Scope
  • Rename all collection variables/params/comments to scope
  • Remove unused Postcomment test stub
  • Fix redundant column extraction in rawDelete
  • Inline performFetch into fetch/fetchAll, remove indirection
  • Remove unused Db::getSql()
  • Remove registerScope calls from tests (feature removed in Data)

- Update all imports and type hints from Collection to Scope
- Rename all collection variables/params/comments to scope
- Remove unused Postcomment test stub
- Fix redundant column extraction in rawDelete
- Inline performFetch into fetch/fetchAll, remove indirection
- Remove unused Db::getSql()
- Remove registerScope calls from tests (feature removed in Data)
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.71%. Comparing base (143955e) to head (8773c9a).

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #118      +/-   ##
============================================
+ Coverage     99.17%   99.71%   +0.54%     
+ Complexity      149      145       -4     
============================================
  Files             3        3              
  Lines           362      353       -9     
============================================
- Hits            359      352       -7     
+ Misses            3        1       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the relational mapper/query layer to adopt Respect\Data\Scope (replacing Collection), while removing dead code and simplifying Db fetch execution paths.

Changes:

  • Replace Collection/CollectionIterator usage with Scope/ScopeIterator throughout Mapper.
  • Simplify Db::fetch() / Db::fetchAll() by inlining the statement execution flow and remove Db::getSql().
  • Clean up tests and stubs by removing unused fixtures and updating tests for the new Scope-based API.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/Stubs/Postcomment.php Removes an unused test stub class.
tests/MapperTest.php Updates nested persist tests to no longer rely on removed collection registration behavior; removes an identity map count test tied to removed API.
tests/DbTest.php Removes the getSql() test now that Db::getSql() is gone.
src/Mapper.php Migrates mapper APIs and query generation from Collection to Scope; simplifies rawDelete parameter flow.
src/Db.php Removes getSql() / performFetch() indirection and executes statements directly in fetch() / fetchAll().
Comments suppressed due to low confidence (1)

src/Mapper.php:242

  • The $scope parameter is not used inside extractColumns(), which makes the method signature misleading (and suggests the extraction depends on the scope when it currently does not). Since this is a private method, consider removing the unused parameter (and updating callers), or use it explicitly if column extraction is intended to be scope-aware.
    private function extractColumns(object $entity, Scope $scope): array
    {
        $dbCols = [];
        foreach ($this->entityFactory->extractColumns($entity) as $key => $value) {
            $dbCols[$this->style->realProperty($key)] = $value;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@alganet alganet marked this pull request as ready for review April 4, 2026 03:23
@alganet alganet merged commit a3c9be3 into Respect:master Apr 4, 2026
7 checks passed
@alganet alganet deleted the scope branch April 4, 2026 03:23
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.

3 participants