On 03/10/2010 01:10 PM, miguelSantirso wrote:
Hi, I have a starts_at field that keeps the date in which certain
event starts or has started (in UNIX seconds). Also, I have a
minutes_long field. I need to filter all the objects that are already
finished and I tried adding the following to my original query:
$q->addSelect('c.starts_at + c.minutes_long*60 AS finishes_at');
$q->addWhere("finishes_at>= ?", time());
However, Doctrine doesn't seem to recognise "finishes_at" in the
"addWhere" statement. I don't know if this is the expected behavior of
Doctrine. If so, how could I write an equivalent query?
Is MySQL your db? I don't believe MySQL supports using column aliases
in a where clause [1]. Try changing $q->addWhere to $q->addHaving ?
jimmyk
[1] A /|select_expr|/ can be given an alias using |AS /|alias_name|/|.
The alias is used as the expression's column name and can be used in
|GROUP BY|, |ORDER BY|, or |HAVING| clauses. <- from
http://dev.mysql.com/doc/refman/5.0/en/select.html
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en