craue / CraueGeoBundle

Doctrine functions for calculating geographical distances in your Symfony project.
MIT License
124 stars 15 forks source link

invalid sql generated #4

Closed digitalkaoz closed 11 years ago

digitalkaoz commented 11 years ago

im having the following problem, getting this bundle to work:

here is my query:

            ->createQueryBuilder('geo')
            ->select('geo, GEO_DISTANCE(:latitude, :longitude, geo.lat, geo.lng) AS HIDDEN distance')
            ->having('distance <= :radius')
            ->setParameter('latitude', $latitude)
            ->setParameter('longitude', $longitude)
            ->setParameter('radius', $radius)
            ->orderBy('distance')

and got the following error:

QueryException: [Syntax Error] line 0, col 76: Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got 'distance'

what am i doing wrong?

craue commented 11 years ago

I can't spot anything wrong here. Which Doctrine version are you using? Could you try removing the HIDDEN keyword?

digitalkaoz commented 11 years ago

removing the HIDDEN keyword did it. so whats the doctrine version that should work with it?

craue commented 11 years ago

It was introduced with 2.2.

digitalkaoz commented 11 years ago

ok, i'll recheck what version i am using

digitalkaoz commented 11 years ago

ok it works with doctrine 2.2.*

maybe you should set a dependency on doctrine/dbal 2.2.*

craue commented 11 years ago

Not sure if either this or just adding a note on not using the HIDDEN keyword with < 2.2.

Which version have you been using before? Did it work well apart from that keyword?

digitalkaoz commented 11 years ago

2.1.7

craue commented 11 years ago

Added a note. Thank you for pointing this out.