fix: allow query to be passed as instance #1178
Open
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.
Summary
PR: Allow Using a Query Instance in Addition to a Class-String
This PR adds the ability to use a
Query
instance in addition to a class-string by default.Before:
Previously, if I built my schema at runtime like this:
I would get the following error:
Cannot use object of type FindQueryForModel as array
Changes:
Field
objects by adding a specific case inGraphQL.php -> buildObjectTypeFromFields
:Documentation:
I have not documented this possibility in
README.md
because it would be a bad practice to use this in the config file. Doing so would break Laravel's caching mechanism, as this type is not serializable.Type of change:
Checklist:
Update the README.md (Not needed)composer fix-style