Skip to content

fix: use actual type for $this->typeTable#32

Merged
didoda merged 4 commits into
mainfrom
fix/types-table
Apr 16, 2026
Merged

fix: use actual type for $this->typeTable#32
didoda merged 4 commits into
mainfrom
fix/types-table

Conversation

@stefanorosanelli
Copy link
Copy Markdown
Member

@stefanorosanelli stefanorosanelli commented Apr 16, 2026

This PR improves the robustness of the object import process by ensuring that only valid object types are used and by handling cases where an object type does not exist and avoiding ObjectsTable direct usage on types extending objects directly.

Initialization and object type validation:

  • Refactored the constructor in Import.php to set the typeTable property only to valid and actual types

Error handling improvements:

  • Updated the saveObject method to throw a BadRequestException if the typeTable is not set, providing a clear error message when an invalid object type is encountered.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.90%. Comparing base (87b84b6) to head (4404737).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main      #32   +/-   ##
=========================================
  Coverage     98.90%   98.90%           
- Complexity      139      141    +2     
=========================================
  Files            12       12           
  Lines           638      639    +1     
=========================================
+ Hits            631      632    +1     
  Misses            7        7           

☔ 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

This PR hardens the import pipeline by validating the requested object type before choosing the table used to create/save entities, and by producing a clearer client error when an invalid object type is provided.

Changes:

  • Refactors Import construction to set $this->typeTable only when the object type exists (via new objectTypeExists()).
  • Adds a BadRequestException guard in saveObject() when no valid type table is available.

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

Comment thread src/Utility/Import.php Outdated
Comment thread src/Utility/Import.php
Comment thread src/Utility/Import.php Outdated
@didoda didoda merged commit 822538d into main Apr 16, 2026
15 checks passed
@didoda didoda deleted the fix/types-table branch April 16, 2026 11:47
@didoda didoda added this to the 3.x milestone Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:patch Patch Version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants