Skip to content

Handling expression in location cast v2 #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 14, 2025

Conversation

tkaratug
Copy link
Collaborator

This pull request introduces support for handling database expressions in the get() method of the LocationCast class, along with corresponding tests. The key updates include refactoring the get() method, adding a helper method for parsing expressions, and expanding test coverage to verify the new functionality.

Enhancements to LocationCast functionality:

  • Added support for database expressions in the get() method by introducing a new private helper method, getCoordinates, to handle parsing of ST_GeomFromText expressions. (src/Casts/LocationCast.php: [1] [2]

Test coverage improvements:

  • Added a new test, it_can_get_a_casted_attribute_using_expression, to validate that the get() method correctly processes attributes provided as database expressions. (tests/LocationCastTest.php: tests/LocationCastTest.phpR77-R94)
  • Included the necessary Expression import to support the new test. (tests/LocationCastTest.php: tests/LocationCastTest.phpR5)

Documentation updates:

  • Updated the CHANGELOG.md file to document the addition of expression support in the get() method for version 2.2.0. (CHANGELOG.md: CHANGELOG.mdR5-R7)

@tkaratug tkaratug merged commit ed03da2 into 2.x May 14, 2025
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants