Handling expression in location cast v2 #42
Merged
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 pull request introduces support for handling database expressions in the
get()
method of theLocationCast
class, along with corresponding tests. The key updates include refactoring theget()
method, adding a helper method for parsing expressions, and expanding test coverage to verify the new functionality.Enhancements to
LocationCast
functionality:get()
method by introducing a new private helper method,getCoordinates
, to handle parsing ofST_GeomFromText
expressions. (src/Casts/LocationCast.php
: [1] [2]Test coverage improvements:
it_can_get_a_casted_attribute_using_expression
, to validate that theget()
method correctly processes attributes provided as database expressions. (tests/LocationCastTest.php
: tests/LocationCastTest.phpR77-R94)Expression
import to support the new test. (tests/LocationCastTest.php
: tests/LocationCastTest.phpR5)Documentation updates:
CHANGELOG.md
file to document the addition of expression support in theget()
method for version 2.2.0. (CHANGELOG.md
: CHANGELOG.mdR5-R7)