I'm new to symfony myself ... but I dont think that Doctrine
understands the Mysql specific function LEAST() in this case.

Eg this listing for SELECT/WHERE clauses doesn't list it:
http://www.doctrine-project.org/documentation/manual/2_0/en/dql-doctrine-query-language#dqlfn

You can always sidestep DQL and issue the raw SQL directly as seen in
the execute() here. By issueing the full update with the mysql least()
call on the connection directly your query will not be altered by the
query building process:
http://stackoverflow.com/questions/2474377/doctrine-update-join

-dg

On Sep 29, 5:56 am, torok84 <toro...@gmail.com> wrote:
> [ In the real application I would have something like
> LEAST(user.points, 300) ]
> Hello, I do not understand very well how the set() function works
>
> I tryed the following code:
>
> $q = Doctrine_Query::create()
>   ->update('User u')
>   ->set('u.points', 'LEAST(200,100)');
> echo $q->getSqlQuery();
>
> But the generated SQL code is
> UPDATE user SET points = LEAST(200)
>
> I tryed some other things, but none of them worked. For example
>   ->set('u.points', '?' , 'LEAST(200,100)');
> will generate
> UPDATE user SET points = 'LEAST(200,300)'
>
>  How can I create the query I want?
>
> Thanks
> Paolo

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to