Как упорядочить вычисляемые поля Doctrine2Php

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Как упорядочить вычисляемые поля Doctrine2

Сообщение Anonymous »


I've got the following doctrine2 query working nicely, it retrieves all 'markers' within some geographical radius.

$qb->select('marker') ->from('SndSpecialistLocator\Entity\Marker', 'marker') ->where('DISTANCE(marker.location, POINT_STR(:point)) < :distance') ->setParameter('point', $point) ->setParameter('distance', $radius); Now I want to sort them by distance.

$qb->select('marker (DISTANCE(marker.location, POINT_STR(:point))) AS distance') ->from('SndSpecialistLocator\Entity\Marker', 'marker') ->where('DISTANCE(marker.location, POINT_STR(:point)) < :distance') ->setParameter('point', $point) ->orderBy('distance', 'DESC') ->setParameter('distance', $radius); But unfortunately this does not work, I am wondering is this possible as distance is not a real property of my entity, but a calculated one?

What is the trick here?


Источник: https://stackoverflow.com/questions/135 ... s-ordering
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»