Skip to content
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

[7.x] Added support for separation between geometry and geography types #30552

Closed
wants to merge 4 commits into from

Conversation

raymondtri
Copy link
Contributor

@raymondtri raymondtri commented Nov 9, 2019

This relates directly to #30545, the arguments for setting geometry as the default type as opposed to the current default geography are there.

However since modifying this default is a breaking change, I believe it would be a pr for a new major version.

I will be updating the 6.x PR to be non-breaking.

private function formatPostGisType(string $type, Fluent $column)
{
if ($column->geography !== null) {
return "geography($type, ".($column->projection === null ? '4326' : $column->projection).')';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, but maybe it will be better to use sprintf method here for better readability?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually just rewrote it with a null coalescer, for that exact reason. Still noodling about what to do on 906 for readability though.

@raymondtri
Copy link
Contributor Author

The differences in this PR as opposed to #30545 are:

  • The ->isGeometry fluent property has been removed, since geometry is now the default
  • The ->geography fluent property has been added, to specify the geography type
  • The ->projection fluent property is unchanged

@driesvints
Copy link
Member

@raymondtri tests are failing.

Copy link
Contributor

@antonkomarev antonkomarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think sprintf will be much readable in this case.

private function formatPostGisType(string $type, Fluent $column)
{
if ($column->geography !== null) {
return "geography($type, ".($column->projection ?? '4326').')';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return sprintf('geography(%s, %s)', $type, $column->projection ?? '4326');

@taylorotwell
Copy link
Member

Please submit with passing tests.

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.

4 participants