Repeated ST::distanceSphere(***)
in example
#154
Answered
by
saibotk
LamprosPitsillos
asked this question in
Q&A
-
Why is the expression Since we named it as $currentShipPosition = Point::makeGeodetic(50.107471773560114, 8.679861151457937);
$portsWithDistance = Port::select()
->addSelect(ST::distanceSphere($currentShipPosition, 'location')->as('distance_to_ship'))
->where(ST::distanceSphere($currentShipPosition, 'location'), '<=', 50000)
->orderBy(ST::distanceSphere($currentShipPosition, 'location'))
->get(); |
Beta Was this translation helpful? Give feedback.
Answered by
saibotk
Aug 27, 2025
Replies: 1 comment 2 replies
-
Yes you are right, this is just to show that the expressions can be used in all those cases. We might need to refactor this to be less confusing though! |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
LamprosPitsillos
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes you are right, this is just to show that the expressions can be used in all those cases.
We might need to refactor this to be less confusing though!