Feature/string backed enum in order by #54042
Closed
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.
I have an enum defined for fields that an API endpoint can be sorted by.
I'd like to pass this directly into the query builder, rather than having to convert to a string.
The change I have made is quite deep in the framework.
Illuminate/Database/Grammar::wrap
is used in a lot of places. That being said, I do not see it being problematic - any BackedEnum being passed towrap
should be handled like so? Code will behave exactly as prior, unless a BackedEnum is passed.As such, this change likely allows for BackedEnums to be used in other places too - happy to look through / update existing DocBlocks if that is desired. I think it will be, I just didn't want to do it too early, and then have the PR rejected.