1

I having problems to generate a doctrine_rawsql with a custom select.

This is my rawsql

$distance = glength(linestringfromwkb(linestring(asbinary(GeomFromText('POINT( FLOAT('30') FLOAT('-3')),asbinary({l.point})))) as distance

$q->select($distance)
                ->from('place p INNER JOIN location l ON p.location_id = l.id')
                ->addComponent('p', 'Place p')
                ->addComponent('l', 'p.Location l')

if I do a $q->getSql() the distance doesn't appears in the generated sql.

Any ideas? I am doing something wrong?

Ian Gregory
  • 5,770
  • 1
  • 29
  • 42
llazzaro
  • 3,970
  • 4
  • 33
  • 47
  • http://stackoverflow.com/questions/2287368/aggregate-values-in-doctrine-rawsql-queries is also trying the same, but hasn't been answered. Did you have any success? – Bouke Aug 18 '10 at 09:08
  • I modified the Doctrine code inorder to allow this. Doctrine only supports SQL standard. This Geom functions/Data arent supported. – llazzaro Sep 03 '10 at 03:27
  • How exactly didn't you modify Doctrine to allow this? I'm also having this problem and am unsure or how to fix it. – Dandy Oct 13 '10 at 15:50

1 Answers1

0

The problem seems to be solved now using Doctrine_Expression

$user = new User(); 
$user->username = 'jwage'; 
$user->updated_at = new Doctrine_Expression('NOW()'); 
$user->save(); 
llazzaro
  • 3,970
  • 4
  • 33
  • 47