fix: use actual type for $this->typeTable#32
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
Importconstruction to set$this->typeTableonly when the object type exists (via newobjectTypeExists()). - Adds a
BadRequestExceptionguard insaveObject()when no valid type table is available.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ObjectsTabledirect usage on types extending objects directly.Initialization and object type validation:
Import.phpto set thetypeTableproperty only to valid and actual typesError handling improvements:
saveObjectmethod to throw aBadRequestExceptionif thetypeTableis not set, providing a clear error message when an invalid object type is encountered.