Skip to content
This repository has been archived by the owner on Nov 4, 2019. It is now read-only.

fix filterByDistanceFrom(..) #31

Closed
wants to merge 3 commits into from

Conversation

mpoiriert
Copy link

The missing variable from the template have been fixe.

@willdurand
Copy link
Member

I don't get your patch..

@mpoiriert
Copy link
Author

It's concerning the pull request 29

In MySQL you can't use WHERE with a generated column, so using filterByDistanceFrom with the new 'Distance'-column crashes:
"Unable to execute SELECT statement
[SELECT *, ABS(6371 * ACOS(x * COS(RADIANS(lat)) * COS(RADIANS(lng) - y) + z * SIN(RADIANS(lat)))) AS Distance FROM table WHERE Distance < :p1]
[wrapped: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Distance' in 'where clause']"

Even the HAVING-clause, which works with newer MySQL versions could be used in this context, does not work with older versions.
So due to compatibility issues I think this file should be reverted (even if that means duplicated code...)

I just properly fix it starting from the change of dominik (his pull request wasn't passing travis).

@mpoiriert
Copy link
Author

If there is any reason why you can't accept the pull request let me know I might have time to adjust it. I starting to use this behavior in a symfony2 project and I prefer to use the main repo than overriding it with a fork...

@snoopckuu
Copy link

@willdurand i have the same problem. Could you please merge this?

willdurand added a commit that referenced this pull request Aug 1, 2014
@willdurand
Copy link
Member

Merged, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants