Как упорядочить вычисляемые поля 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

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